Tracking Clicks on Links with Google Tag Manager: A Practical Guide with Examples
I already wrote about how click tracking is very important in web analytics in the first part of this article Tracking Clicks on Site Elements with Google Tag Manager: An Advanced Guide (If you haven’t read it yet, be sure to do so). But even more important is tracking clicks on links. After all, a user clicking on a link can go from your site to another, and you lose your visitor. Or by clicking on a phone number or email can contact you. The second of course is much nicer)
Such action, of course, should not be allowed to flow. They need to be tracked and analyzed. If you have already read the previous article, you know that tracking clicks on links can be done with two types of triggers: All Clicks and Just Links. We learned about the first one above, so let’s look at the second one in detail today.
Just Links Trigger in Google Tag Manager
There are only three settings to set up:
- Wait for Tags. This setting allows you to set an extra time for the activation of the tags associated with the click. In this case, the link will be delayed for the time specified in the appropriate field or on the activation of the required tags.
- Check Validation. Allows you to activate tags only when the link is successfully clicked. If not checked tags will be triggered at any click on the link. Note: if your code on the site uses event.preventDefault() command, you need to uncheck this option or the listener will not be triggered.
- The Enable this trigger when all of these conditions are true only appears when the Wait for Tags option is activated. It allows you to activate the trigger only when certain conditions are met. It should not be confused with This trigger fires on (Trigger activation conditions). If you want the trigger to be triggered on all pages, use the regular expression .*.
In practice, you will often omit the Expect tags and Error-checking settings if they are not necessary. The basic conditions are set in the Trigger Activation Conditions section.
Now that you have the basic parameters of the Just Links Trigger, let’s take a look at some examples.
Tracking clicks on outbound links with Google Tag Manager
One of the main goals in marketing is not to lose your customers and visitors. But creating a functional and useful site that doesn’t have a single outgoing link is almost impossible. But to track which links users follow most often – it’s quite realistic. Setting is very simple. The only thing you need to know is that information about clicked links is stored in the Click URL variable. All outgoing links are links that do not contain your domain name.
Tracking clicks on outbound links with Google Tag Manager
Use a standard event tag to send this and other events to Google Analytics.
Tracking clicks by phone number using Google Tag Manager
Another example of using the Link Only Trigger – tracking clicks by phone number. Particularly useful for sites without call tracking. You may also be interested in phone number substitution for various sources with the help of Google Tag Manager.
As you can see, there is nothing complicated about working with the link trigger and transmitting click events data. For the most part, the algorithm is as follows:
- Determine which link is clicked and which you want to track;
- We create a trigger of type “Links Only”;
- Specify the condition with the Click URL variable;
- Create a tag to send the data to Google Analytics.
If you have any other ideas for using the Links Only Trigger, post them in the comments.