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:-
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.