Tracking outbound links in Google Tag Manager is not a new topic – we’ve written a guide explaining how to do it before – but there is a more efficient way to do it nowadays. Last year, Google introduced a new component type for the Auto-Event variable in Google Tag Manager.
The old method involved setting up a trigger for clicks which don’t include ‘yourdomain.com’ – the new method is a little smarter. We can create a new Auto-Event variable which will return ‘true’ or ‘false’ as its value if the link clicked is outbound or not.
The ‘Affiliated Domains’ field can be left blank if you only want to check the domain GTM is installed on vs the domain in the link the user has clicked, however, you can insert a comma-separated list here of other domains you consider to be affiliates which will not then be considered outbound. It’s probably reasonable to think about this list as an extension of your cross-domain tracking setup and align them accordingly.
As I said though, if you just have one domain to consider as part of your setup (i.e. the one your GTM container is installed on), you can leave this field blank.
If a user then clicks on a link on your website which takes them to a different domain, this variable will return ‘true’ (see below).
This in turn means that if we want to set up a tag to track Outbound Link clicks, we would simply need to configure our trigger as per below:-
Note: the Auto-Event variable will automatically disregard invalid links (e.g. mailto: links, javascript:void etc) so that is a nice little bit of house-keeping that no longer needs to be considered within your trigger setup.
Why use the Auto-Event variable for Outbound Link tracking?
If you manage a large, interconnected set of websites, you could use a variable that lists all your affiliated domains and insert it in the ‘affiliated domains’ field. You could then use the same variable as part of your cross-domain tracking setup too. Meaning anytime that list of affiliated domains needs updated, you can just update that one variable, rather than having to go through and update references across lots of different tags. Much more efficient.
Another benefit would be if you had a basic setup (with no affiliated domains), you could simply export this tag from one container and import to another and it would work right away with no additional configuration required. Again, more efficient if you manage lots of GTM containers across lots of independent websites.
While this was a relatively small addition to the GTM interface, it allows us to work smarter and we’re big fans of that.
Any questions or if you need help setting this up, just let us know – we’re always happy to help.
Posted by
Michael Wilson
Michael is the Digital Analytics Director at GlowMetrics, implementing complex tracking for our largest clients via Google Tag Manager while leading our wider analytics work across Google Analytics, Data Studio and Optimize
Read more from Michael WilsonBrowse by Category
- Social Media
- SEM
- SEO
- Google Ads
Digital Marketing
- Google Analytics
- Google Tag Manager
- Google Opimize
Digital Analytics
Optimise your website and marketing campaign performance with Ireland’s leading digital analytics agency
Sign up to our newsletterEnjoyed reading this article? Find more like it below…
Posted by
Georgia Sloan
Oct 31st 2023
Company Updates
2 min read
Get to know Georgia!
Hi, I’m Georgia. I have recently joined the Glowmetrics team as a Digital Analytics Assistant. My journey into this role began with an undergraduate degree in microbiology, which led me...
Posted by
Nicola Russell
Feb 15th 2019
Digital Analytics Insights
4 min read
It’s time to check your Google Analytics for Amazon Bot Spam
UPDATE: As of 4th February 2020, the 'Network Domain' and 'Service Provider' dimensions in Google Analytics have been marked as 'no longer supported' and are returning (not set) values -...
Posted by
Hannah Magorrian
Mar 28th 2023
Digital Analytics Insights
2 min read
Alternatives To Google Optimize Post-Sunset
Goodbye Google Optimize! Google has recently announced they will be sunsetting Google Optimize and Optimize 360, effective from 30th September 2023. The announcement cited Google’s desire to provide a better...
Leave a Reply