How to track Link Clicks as Events in Google Analytics using Google Tag Manager?

core-web-vitals-page-experience
How ‘Page experience’ influences your webpage’s rank
November 16, 2020
Show all

How to track Link Clicks as Events in Google Analytics using Google Tag Manager?

track link clicks in GTM

The field of Digital Analytics has seen the use of many tools. Google Analytics is one of the most widely used tools in this industry. Google Tag Manager helps you set up Google Analytics for your website, even without adding any further codes. You can also tweak your setup with the help of available configuration options, based on your personalized needs. All you need to do is first create accounts on Google Tag Manager and Google Analytics, and install the GTM code snippet on to your website. Using the Google Tag Manager dashboard, you can install Google Analytics for your website pretty easily. 

Google Analytics can help you keep track of any activity on your website. It records the page views by default. You can also keep track of important metrics like bounce rate, time on page, etc. with the help of Google Analytics. 

However, you might as well want a record of the number of times a particular link has been clicked on your page. This can be achieved with the help of Events in Google Analytics. In this article, we will see how Link Clicks in GTM are captured and stored as events. 

Step-1

First of all, you need to make sure that all the click related variables are enabled in Google Tag Manager. To do that, you would have to go to the GTM Container workspace. Here, find and click on “Variables” and then click on “Configure”. From the menu that appears, find the click variables and ensure that all of them are enabled. 

Step-2

Now, we have to put GTM in the preview mode. This will help us to see the GTM Preview and Debug pane. Find the “Preview” button at the top right in the GTM Container. Now, you can open the website on another tab to see the Preview and Debug pane.  

Step-3

Now that we have activated the Click event variables, we need to create a trigger than fires the moment someone clicks on any of the given links on your webpage. To create the trigger, go to the “Triggers” section and click on “New”. Google Tag Manager will ask you to name your trigger. Under Trigger configuration, you have to select the trigger type as “Just Links”. 

Step-4

Before moving to the next step, we should check if the trigger created works correctly or not. First, refresh the preview. Now open your webpage and allow the Preview pane to load. Once the page loads, click the link on the page with the CTRL key held. This will make sure that the click target opens in another window, allowing you to see the Preview pane. 

As soon as the link gets activated, a new event “gtm.linkClick” gets fired in the Preview pane. 

To see all the click-related variables that have been captured, click on the “gtm.linkClick” and then on the “Variables” tab. 

Step-5

The trigger setup is now up and running. Now, you can create a GA tag that can capture the link clicks in GTM as events in Google Analytics. There is a “Tags” option on the GTM Container Workspace. Click on it, and select “New”. The new tag has to be named. Click on “Tag Configuration” that allows you to select the appropriate tag. Here, you have to choose “Universal Analytics” and then change the Track type to “Event”. Also, two parameters are mandatory for all events, Category, and Action. In our case, the category would be “Click” and the action would be the URL of the click, which is implemented using Click variables.. .

All clicks on the links on your website can now be tracked as Events in Google Analytics. Save all the changes made when done with the Tag configurations.

Step-6

The tag now has been successfully saved. All you need to do is check if the click tag is firing when the links are clicked. Go to your website and click on a link with the CTRL key pressed. Any click would automatically fire the “gtm.linkClick” event. You can see the name of your click tracking being fired. 

Step-7

After it has been properly established that the tag fires for the links, you can now exit the preview mode to publish the tag in the GTM container. Click on the “Submit” button located right next to the “Preview” button. 

If the tag has been applied correctly, Google Analytics will show you that it is working properly through its real-time Dashboard. The events usually become active in the behaviour section within 24 hours.  

Leave a Reply

Your email address will not be published. Required fields are marked *