Monday, 29 October 2018

How to track button clicks in Google Analytics using Tag Manager?

This post shows you how to track button clicks on a website using Google Tag Manager. I assume that you not only know how to install Google Analytics using Tag Manager but have already done that on your website.


So here is a page with the 'Shop now' button. Let's see how to track this button clicks using GTM.


Step 1: Enable Click Variables

  • Login to GTM, go to Variables>>Configure
  • Enable the 'Clicks' variables


Step 2: Create a Shop Now button trigger
  • Go to 'Triggers' and create a new trigger. Give it a relevant name like 'Shop now button click'.
  • Choose 'Just Links' as the trigger type
  • Select 'Some links'
  • Enter the conditon 'Click text' equal 'Shop now' as shown below
  • Save

Step 3: Create a Shop Now button tag
  • Create a new tag with a relevant name like 'GA Button click'
  • Select 'Google Analytics – Universal Analytics' as the tag type
  • For 'Track Type', select 'Event'
  • Enter the event tracking parameters as below:
  •     Category: Click     Action: Shop now     Label: {{Click URL}}
  • For 'Triggering', select the 'Shop now button click' trigger that you created earlier
Save
Step 4: Preview in Google Tag Manager
Use the Google Tag Manager preview to see if the tag fires as designed.

Step 5: Cross check with Google Analytics' Real-time stats.
In Google Analytics, go to Real-Time>>Events. Any events fired in the last few minutes can be seen there.