Outbound Link Tracking via Google Tag Manager

Written 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.
March 24, 2016

Want to know which links your visitors are clicking on on your website and where they head off to? If you have a link to a third party website, by default in Google Analytics, you’ll have no idea how many of your users are clicking on that link or much traffic you’re sending to that third party – but by setting up Outbound Link Tracking via Google Tag Manager, you can see exactly that!

So, how do we do it? Here’s a quick how-to guide:

Step 1: Create the Tag

outboundlink1

Insert your own GA tracking ID when configuring the tag, feel free to use your own naming convention for the Event Category and Event Action but it’s important to use the {{Click URL}} variable for the Label – this will automatically pull in the URL of the link the user clicked on so you can see that information in your Google Analytics event reports.

Step 2: Create the Trigger

outboundtrigger1

We want to track whenever a user clicks on a link, so we’re using a Click Event trigger targeting ‘Just Links’.  We’ve selected ‘Wait for Tags’ so the tags have a chance to fire before the user moves away to the new URL and we’re enabling it on every page using the RegEx .* (if you’re not familiar with Regular Expressions, this will match everything).

The important part here is the Fire On rule, which states the Click URL does not contain yourdomainname.com (for us, it’s glowmetrics.com, yours will be whatever your website address is).  This tells the tag to only fire whenever a user clicks on a link on your website that goes to a different website.  Makes sense, right?

Once you’ve set up the tag and trigger, remember to publish your changes in GTM.  Then whenever you’ve done that, you should be able to see Outbound Links being tracked in your Google Analytics account like this:

outboundlinksexample

Easy when you know how!  If you’ve got any questions on tracking Outbound Links or you would like more help with your Google Tag Manager set up, leave a comment below or Contact Us – we’d love to hear from you.

1 Comment

  1. chris

    Is there a way of doing this, but not hard coding the domain name? So in pseudo code something more like

    Click URL does not contain THIS.domain

    where THIS is automatically set to the current domain?

    Thanks
    Chris

Enjoyed reading this article? Find more like it below…