Through this post I will assume that you already know that Google Tag Manager is formed by macros, rules and tags, and you are familiar using them. I will also assume that you know what are the tags and macros you can utilise for auto event tracking. If you don’t, not to worry. Just read the previous post and ask us any question you may have!
The tag for auto event tracking named as Click Listener will be waiting and listening for any click on any in-page element. This can be any click on a button or link, but any click on the content as well.
Let’s explain now how to configure this tag, how to see what information we can get and how you can configure it to use it in your website and send information to Google Analytics.
Step 1 – Configure the listener
The fist thing to do is to configure the listener tag. To do this, we just need to create a new tag and select the Click Listener Tag. The following screenshot illustrates it:
As you can see in the previous image, we are using the rule All Pages. This will be executed on any page, and this is because we want it to be listening for every click on every single page of the site. IF you want it to be used on just one or a few pages, you can create your own rule.
We have now our listener configured and listening for clicks on in-page elements. As you can read from the previous screenshot, this listener executes the gtm.click event from Google Tag Manager, and this event can be used to perform the desired action.
Step 2 – Create the rule
Now we are going to use this event to create a rule, and then we’ll use the rule to execute an action and define when we want to send information to Google Analytics.
Step 3 – Configure the macro
This step will involve creating a macro that will allow us getting the information about every click, and later being able to identify every single one when sending information to Google Analytics. For this scenario we’ll use the Element macro to get information about the object to which the user has clicked on. As any click on the page will be tracked, this is the perfect scenario to get any click categorised automatically.
At this moment we’ve already created the listener and configured the rule which our tag is going to follow. We’ve also captured the value of the element for every click through the element macro. The next step is sending the information to Google Analytics through Event Tracking.
Step 4 – Sending the information to Google Analytics
To send the information about the click to Google Analytics, we’ll need to create a Google Analytics Event tag, such as in the following screenshot:
We’ve set up the rule based on the event that the listener generates, which is gtm.click. Hence every click will execute this tag and will send an event to Google Analytics.
The strategy defined to capture this through event tracking uses the action field to store the element type, and the label to store the URL of the current page. This will let us utilise advanced filtering and secondary dimensions, in order to be able to report every single click due to a specific page.
The following screenshot shows the values that the tag populates automatically into Google Analytics through the macro:
Do you want to read about the other different Auto Event Tracking Tags available in Google Tag Manager?
- Form Submit Listener (Coming Soon)
- Link Click Listener (Coming Soon)
- Timer Listener (Coming Soon)