It’s easy to make a mistake when you setup your click tracking in Google Tag Manager or you just may not know how to define the click triggers.
Here’s a way to understand how GTM sees your click elements and end up with a properly working click tracking.
Let’s say we have a button that we want to add click tracking to.
First, go to Variables page in GTM and make sure all Click variables are enabled: Click Element, Click Classes, Click ID, Click Target, Click URL, Click Text.
Next we want to create a simple click event for all clicks.
1. Go to Tags – New, give it a name, and select Google Analytics and Universal Analytics as product and tag type.
2. Enter your GA tracking ID or use a variable if you have one. Select Event from the track type drop-down and give it some generic category and action values.
3. Now for your trigger in the Fire On section, select Click, give the trigger a name and select All Elements for All clicks.
4. Save your tag.
Enter Debug mode and refresh the page of your website which has the button you want to track clicks on. Let’s say I want to track the clicks on the comments balloon icon on the blog. Click the button while pressing Ctrl key so it opens a new tab, and let’s see what the Debug console looks like:
So we have our click tag firing. Now click gtm.click in the Summary pane on the left and select Variables at the top. Here we can see what data layer variables GTM sees for this element so we can use them to improve our trigger to track clicks on this button only, and not all clicks:
You can use either the click classes or click ID if these are available and unique, or for an element like click URL we may select condition like contains “respond”.
That’s all! A quick way to properly set your click tracking.
P.S. Got a Google Analytics question? Send it to me and I’ll try to answer it on the blog.