Latest News

Precise Steps to Track Specific Outbound Links

How to Track Specific Outbound Links in Google Tag Manager.



Google Tag Manager is good for you, helping you keep track of all kinds of things without having to spend hours and hours of coding.  One of those things you may have wanted to track, but felt like it might be too hard?  Outbound links.

Why would you want to track outbound links?

It’s not a common occurrence but there are a few instances where you’d want to know how people are leaving your site.

1) If you have another service housed on a separate domain.  You likely have a banner link as a cross promotion on one site and would like to track clicks.

2) You might have an affiliation with another business.  It could be a special promotion or a guest blogger, but this is a good way to ensure you have a good idea of how much traffic you’re sending to that 3rd party.

Here are the steps you need to take in Google Tag Manager in order to be able to track specific outbound links as a goal in Google Analytics.

Step 1:Auto Event Variable Setup

First thing you’d need to setup is an Auto Event Variable to capture the host name/domain.



Enter the following options:

Variable Name: Click URL Hostname (this can be anything you like – but it’s best practice to have a name that describes your configuration)
Choose Type: Auto-Event Variable
Variable Type: Element URL
Component Type: Host Name

“Strip www.” is an optional setting to use the domain value without the “www.”

Step 2: Triggers Set-Up (2 triggers to set up)

this creates the rule that triggers the recording in analytics.

Make sure the URL link is indeed an outbound link (going to new domain).




Name: Hostname Not Your Domain (again this name can be anything, but it will describe what this trigger does)
Choose Event: Click
Configure Trigger type: Link Click
Wait for Tags option ticked
Check Validation option ticked
Enable When: url matches RegEx .*
Fire On: Click URL Hostname does not contain – put your domain here so if this was for WebSavvy, it would read ” Click URL Hostname does not contain www.websavvy.com.au”

The second trigger is the specific outbound link.  An essential part to tracking the specific page!



Name: Banner Outbound Link Click (yup – you can name this anything you like – but best practices….)
Event: Click
Trigger type: Link Click
Wait for Tags option ticked
Check Validation option ticked
Enable When: url matches RegEx .*
Fire On: element url equals othersite.com/image (this is the site that you’re banner or link is sending traffic to)

Step 3 – Tag Setup

Now you need to combine these two triggers you just set up together as the rules for them to fire.



Name: Banner Outbound Link Click Tag
Product: Google Analytics
Tag type: Universal Analytics
Tracking ID: Your Analytics ID. (Here I’ve saved the ID as a Variable named UA-Main and used it)
Enable Display Advertising Features: True (If you want to get extra data in Analytics such as interest and demographic info.)
Track Type: Event
Category: Banner Outbound Link Click
Action: Link Click
Label: othersite.com/image
Fire On: Click
Any of these triggers will fire your tag: “Banner Outbound Link Click” and “Hostname Not Your Domain”  (although – if you’ve renamed them, you’ll need to use those names you used!)

 Now you’ve made a rule that start to track specific outbound links!

Remember to preview and test if the tag is firing, especially after you’ve just created it!  It’s also a good idea to publish and then test if it’s recording in Analytics under Real-Time > Events.

You’ll also need to setup an event goal in Analytics in order to track it!



Back to all News posts