Tracking Click Events In Google Tag Manager
June 7, 2017
Google Tag Manager makes tag placement simple. Many users utilize GTM for placing conversion tags but you can track many other page elements as well.
In this article, we’ll tackle a scenario in which we track click events on a webpage. Tracking click events is helpful for sites that don’t have separate confirmation pages. Events are also useful for tracking specific interactions on the site, such as buttons and widgets.
While the example in this article cover clicks, you may utilize the same methods for any page element. The same GTM usability features we covered in the previous article will all carry over to whatever you track.
Adding Additional Information for Triggers
Triggers are necessary for firing tags at the correct time. Many users start with page path triggers. These triggers fire tags on specific pages, such as order confirmation pages. Page paths handle the most basic tag implementations but only scratch the surface for trackability.
What if you want to track other elements on the page?
The easiest way is through listeners. These listeners monitor for specific actions or events on the page. If you want to appreciate this more fully, look up click event listeners and try manually doing this first.
If you happened to look that up and thought, “I hate this” or “isn’t there a simpler way?” you’ll be happy to know GTM will take care of the basics for us!
Although it’s not enabled by default, we can create listeners in GTM with the click of a button.
First, navigate to the variables menu.
Now, click configure under built-in variables. A new menu will pop up and you can now enable whichever elements you need.
For clicks, you will most often use click ID and click class. If there is something else you’d like to use, go ahead and enable it as well.
If this sounds like gibberish to you, don’t worry. These pieces are all standard HTML and we’ll bring it all back together shortly.
Tagging A Click Event
There are only two more tasks to complete once we enable the proper variables. We need to create an event and then we need to create the actual trigger.
Events In GTM
GTM offers integrated solutions for Bing and Google Analytics event tags. This feature allows you to track specific actions across your site. The first step is picking your naming convention for the category, action, and any of the optional parameters.
Then go into the tag menu of GTM and select the GA event Tag or Bing Ads custom event. Fill in the parameters with your preferred values and you are good to go.
If you are using another platform without an integrated solution you can always use the custom HTML tags to implement them. Many platforms will even offer specific directions on implementing their tags in GTM.
Creating The Trigger
Earlier in the article, we enabled the click variables, Now it is time to use them. So far, we know there are certain elements we can use as triggers but how do we find the actual values?
Let’s use an example from PPCHero.com. In this scenario, we want to track users who click the subscribe button and join the email list.
To find the necessary details, we can right click and inspect the element using the web developer tools. The actual look will vary depending on your browser but all offer the same information. If you are using Chrome, you should see something very similar to the screenshot below.
The HTML for the subscript button has the class listed as subBut. We can take that information back to GTM and create our trigger based on the class.
You can do this with almost any element in the page source. Below is what we’d look for if we were tracking users who clicked the load more button.
Once you have everything set up you can preview. If everything checks out, publish your tags and happy tracking!
We covered a basic example in this article. Page tracking and click tracking will take you far. You can even take the same concepts and apply them to form tracking as well as more advanced solutions.
Browse By Category
The Focused Event You've Been Searching For
We at Hanapin Marketing recognize the incredible pace of change in the digital advertising industry and are constantly learning in order to keep up with the newest updates, platforms, and rollouts.
A Closer Look at AdWords Smart Bidding
Take a closer look at 4 of the newest smart bidding options in AdWords. Save some time this holiday season by trying them out for yourself!
A Guide to Remarketing in the SteelHouse Advertising Suite
Looking for remarketing alternatives to AdWords, DoubleClick, AdRoll or Criteo? Consider the SteelHouse Advertising Suite!
A bi-weekly newsletter packed full of resources and strategies that will help make you a better PPC expert.
Hanapin Marketing | The PPC Agency of Experts Behind PPC Hero
6 Tips For Efficient Facebook Advertising
Looking for ways to become more efficient with your Facebook advertising? Here are 6 easy tips that will help!
Promotion Extensions: A Quick And Easy Boost For Ecommerce PPC Campaigns
Google’s new promotion extension is on its way to becoming one of the best ad extensions in an ecommerce PPC advertiser’s toolbox.
5 Lessons I've Learned (the hard way) in CRO
New to Conversion Rate Optimization? Learn 7 lessons from an experienced CRO Manager today!