Sat, May 25, 2019
The original article was written on May 25, 2019, and it focused on sending data to Google Analytics Universal. However, during the migration of the blog to a new CMS, I decided to update the content to reflect the current version — Google Analytics 4.
I’ve already written in the first part of this article how important click tracking is for web analytics: Tracking Element Clicks on a Website Using Google Tag Manager. (If you haven’t read it yet — be sure to do so.) But even more important is tracking link clicks. When a user clicks a link, they might leave your site for another one — and you lose that visitor. Or they might click a phone number or email and contact you — which, of course, is much more pleasant.
If you’ve read the previous article, you know that link clicks can be tracked using two types of triggers: All Clicks and Just Links. We've already covered the first one, so today we’ll focus on the second.
Before we dive into practical examples, let’s break down how this trigger works.
When configuring it, there are only three main settings:
event.preventDefault()
, you should uncheck this option, or the listener won’t work..*
.In practice, the settings Wait for Tags and Check Validation are often not used unless there’s a specific need. Main conditions are usually set in the This trigger fires on section.
Now that you know the basics of the Just Links trigger, let’s look at practical examples.
Before we get into real examples, don’t forget to enable the built-in Click variables. All the following setups rely on them.
One of the most common uses of the Just Links trigger is tracking phone number clicks — especially for websites that don’t use call tracking.
You might also be interested in my article on dynamically replacing phone numbers for different sources using GTM.
To configure this, you need to know just two things:
tel:
.Let’s use this. The trigger setup will look like this:
To send this (and other events in this guide) to Google Analytics 4, use a standard event tag. It might look like this:
Optionally, you can add a parameter to pass the clicked link (the phone number) using the Click URL
. The configuration will then look like this:
In the following part of the article, I will no longer focus on GA4 tag configurations, since the only differences will be the event name and, if needed, the presence or absence of a parameter. We'll focus entirely on other popular ways to use the Just Links trigger.
Email isn’t as popular as it once was — messengers are gradually replacing it. But there are still niches where most clients contact you via email. Like phone links, email links have a specific pattern — they start with mailto:
.
In that case, this trigger works:
Add your event tag — and you’re ready for production.
To track direct file downloads, remember that the user typically clicks a file link first. For example, to track downloads of .xlsx
files, use a trigger with this condition:
To track multiple file types, use a regular expression. For example, to track .pdf
, .xls
, and .xlsx
:
Google Analytics 4 has a built-in enhanced event called file_download, which can automatically track file downloads. But that doesn’t mean this method is outdated — you can still use it to send similar events to other systems.
Here’s how to send the same data to Meta Pixel:
For tips on analyzing downloaded files, see my article: “How to Find Out Which Files Are Downloaded Most Often on Your Site”.
One of marketing’s key tasks is not to lose visitors. But it’s practically impossible to build a good site with no external links. What you can do is track which external links are clicked most often.
The setup is simple: External links are those that don’t contain your domain. For example, for my blog, use this trigger:
GA4, as part of its enhanced measurement feature, can also track clicks on external links. This is handled by the click
event. I’ve already written about how to work with it and analyze external link clicks in GA4 in a separate article.
And finally, let’s track clicks from your site to social media. As you probably guessed, just specify the link in the condition field. Here’s an example for Facebook:
As you can see, working with the Just Links trigger and sending click event data is straightforward. The general workflow:
If you have other ideas for using the Just Links trigger — share them in the comments!
If you enjoyed this content, subscribe to my LinkedIn page.
I also run a LinkedIn newsletter with fresh analytics updates every two weeks — here’s the link to join.
Web Analyst, Marketer
Tracking Clicks on Social Media Links Using Google Tag Manager