Hudson Creative Documentation

Tracking Outbound Links In Google Tag Manager


To begin open the account associated Tag Manager account. If you haven’t yet set one up, please refer to this link.

  1. In Google Tag Manager click into triggers
  2. Create a just links trigger
  3. Title the trigger “Link Clicks”
  4. We want to track all links at this point to see if this trigger works
  5. Save
  6. Refresh preview mode
  7. Test an outbound link click
  8. Link click should populate in the Tag Assistant window (see image for reference) 

Once we see that this trigger works we want to differentiate between internal site clicks and outbound clicks

  1. Go back to Tag Manager and click on Variables
  2. Scroll down to “User-Defined Variables”  and click new
  3. In the dropdown menu select “Auto Event Variable”
  4. Title the variable “aev – Outbound Link” Under variable type select “Element URL”
  5. Under component type select “Is Outbound”
  6. Within affiliated domains, you can add URLs for sites that you do not want to count as an external link click
  7. If multiple separate by commas
  8. If outbound click should be tracked as external do not add here
  9. Once complete save and refresh preview mode.
  10. Test the variable by clicking on your outbound link
  11. Within the link click trigger you should see your “aev – Is Outbound” variable
  12. If added as an affiliated link the value should be false. (See image reference)

Once we see the variable working go back to Tag Manager

  1. Click into triggers and select the Link Click trigger we created previously
  2. Update title to “Link Click – Outbound Links
  3. Under “this trigger fires when” select some clicks
  4. Under “Fire this trigger when an Event occurs and all of these conditions are true” in the first box select the “aev – Is Outbound” variable > in the second box select “equals” > in the third box enter “true
  5. Now select wait for tags > Another drop down will appear > In the first box select “Page URL” > In the second box select “Matches RegEx” > In the third box enter “.*” this (.*) matches up to any URL that GTM is installed on)
  6. Save 

Now that we have created a Trigger, we move on to building out the Tag.

  1. Click into “Tags
  2. Select “New” “Google Analytics: Universal Analytics
  3. Add name “GA – Event – External Link Clicks
  4. Track Type “Event
  5. Category: enter “External Links
  6. Action: Click into variables and select {Click Text}
  7. Label: Click into variables and select {Click URL}
  8. Non-Interaction Hit: Select “true
  9. Under Google Analytics setting select the google analytics variable that should have been created during the basic GTM setup
  10. Trigger: Select the “Link Click – Outbound Links” trigger we just created
  11. Save 

Now it is time to test again!

  1. Refresh preview mode to test
  2. I tested out a click to a link that I listed as affiliated first, when I click into it the link click trigger fires but no tag fires (see image)
  3. To test that the outbound tag fires on unaffiliated external links, I clicked into the Instagram extension, and our GA – Event – External Link Clicks tag fired!
  4. This shows that we are properly tracking outbound link clicks (see image 2)

Congratulations! You have now mastered the art of outbound link tracking.