What is a Click Class on Google Tag Manager?
You can easily identify and track button clicks by using the Click Classes in your Google Tag Manager variables.
In general, tracking clicks is a vital metric for understanding how users interact with your site and to analyze better your marketing actions' performance. It is also used on onsite campaigns, email marketing campaigns, adverts and many more.
In our example, we are going to track the Add To Cart button clicks from a website, in order to monitor user behaviour and to provide us with helpful insights when we will need to conduct click attribution
By using Click Classes, you can track the click actions triggered by every button element containing the specific class.
1. You will then need to go to your website to find the appropriate click class from your Add to Cart button. Visit a product page on your website, right click on the Add to Cart button and select “Inspect” from the dropdown menu.
2. In the DevTools window that opens, you can find the HTML element already highlighted. Look for the “class” attribute and select a class that is unique to the Add To Cart button.
💡 It is important to use a unique class, in order to avoid miscalculations of the clicks and to increase the accuracy of the clicks.
In this specific case we will use the “buy-button” class.