Step by Step: Outbound Link Tracking in Google Tag Manager

Following up on last week’s post on event tracking, I thought it would be a good idea to deep dive on outbound link tracking. Outbound link tracking is super easy to setup using Google Tag Manager and the insights you can gain by understanding the most common paths to leaving your website are definitely worth the minimal effort to implement. So, without further ado, here is a step by step guide to setting up outbound link tracking via Google Tag Manager.

Before you being, be sure you’ve enabled the necessary pre-defined variables in Google Tag Manager.

Step 1: Create a new tag in Google Tag Manger.

– Select ‘Google Analytics’ as the tag and Universal Analytics as the tag type
– Choose ‘Click’ for what triggers the tag to fire


Step 2: Create a new trigger

– Select ‘Click’ as the event.
– Configure the trigger by naming (I’d recommend naming it ‘Outbound Link Click’) and choosing the trigger type. In this case, the trigger type should be ‘Link Click’
– Enable this when the ‘Page URL matches RegEx .*’ (this means it will be enabled on all of your pages)
– Since you’ll only want the trigger to fire on outbound links, you’ll need to set the filter to fire when ‘Click URL does not contain’ (otherwise it will fire on all link clicks, including clicks to other pages on your own website)


Step 3: Configure the tag. This is where you will add your property ID and name the event tracking parameters

– Name the tag. I’d recommend ‘GA – Outbound Link Click’ as it’s clear this is a Google Analytics tag and it’s tracking outbound link clicks. If you have a lot of tags in your container, you’ll appreciate a naming structure like this as you’ll be able to differentiate between GA, AdWords, Doubleclick, and other tags with a quick glance.
– Choose a track type of ‘Event’
– Add your tracking parameter specifics:

Category: Outbound
Action: Page URL (this is a pre-defined variable which gathers the page URL where the link was clicked from)
Label: Click URL (this is a pre-defined variable which gathers destination URL where the link click takes the user)


Step 4: Save the tag, then preview & debug. Be sure to test this out on an outbound link to ensure the tag fires when you click an outbound link from your website. Once you’ve confirmed this, publish the tag!

The final tag should look like this:


Happy Tagging!


Posted by Krista Seiden in her own words, not on behalf of her employer

Leave a Reply


  1. Hey Krista,

    Correct me if I’m wrong, but the link click listener in your example would send an event for both inbound and outbound links. If you wanted to set it up for just outbound links, you would need to add a filter for clicks on links that do not match {{url hostname}} of your site.

    • bloggerchica

      Yep, thanks for that! I also realized this shortly after posting and quickly corrected. Thanks!

  2. Paul

    Great post, thanks Krista. Can you perhaps add to the introduction of your post an explanation of *why* or in what cases one would typically wish to track outbound links: banner or affiliate ads, reciprocal links, etc. etc.? It would be very helpful to newbies to understand what purposes outbound link tracking can serve. Thanks so much for the write-up.

    • bloggerchica

      Outbound link tracking is great to understand what pieces of content on your site lead to the most exits/clicks out. How you use this data is really up to you, but some good use cases would be 1) proof of high volume referrals to other sites, 2) understanding of the outside content your users are most interested in, and 3) good way for you to track where you are sending users most so you can re-evaluate that strategy later on. There are many other use cases as well – if you’ve got a few you feel strongly about please leave them in the comments!

  3. What if the outbound url is masked, and thus instead of targetting “does not contain” “mydomain” I am saying “does contain” “/go/” as /go/ is the base for my outbound redirects but not sure it is firing.

    Due to the confusion between the old tag manager and the new tag manager and the multiple tutorials online I am not sure if I am missing a step. You add the container code to just inside the opening but the old approach also mentions adding a with data layer into the of the site. Is that still required?

    Thanks for your help.

  4. Vinay

    I created tags using Google Tag manager i.e. Universal Analytics tag for all outbound links and Link Click Listener as you have mentioned. Still I’m not getting any counts. Do I need to add any rule/goal in Google Analytics and how to link it?
    Appreciate for your quick help

  5. We just started our GTM exploration and this post is going to help us discovery more about this great tool.

    Thanks so much!



  6. I’ll right away snatch your rss as I can’t find your email subscription hyperlink or e-newsletter service.

    Do you have any? Kindly permit me know so that I may subscribe.

    • Krista

      There is an email subscription box on the right hand side of the homepage.


  7. Krista, I want to thank you so much for this tutorial. There are loads of material how to build great landing pages, suggestions to test and measure clicks on all imaginable page elements, how one should observe conversion funnel… But almost no tutorials for beginners how to actually set up measuring some basic things on your website. Is there a good tutorial how this tag outcome in Google Analytics can be viewed? I understand all user actions tracked with tags end up under Behavior > Events category? What is the next step when my tag seems to work?

  8. RJG2

    Going to give this a try, but one question:

    What about internal relative URLs that don’t contain the hostname, how are those being ignored here?

    • RJG2

      Nevermind, found it in another article:

      If you’re wondering how this Trigger works with links that have relative targets, such as:
      Back To Home
      Don’t worry. The Trigger works for these as well, since it doesn’t access the href attribute of the A element. Rather, it grabs the value from the DOM property named href, which will always have a fully-formed URL value with the hostname and all.

  9. Greg

    Thanks for a great article! Quick question: how would you recommend determining which link was clicked if you have the same outbound URL in multiple locations on the same page?

    • Krista

      You could use something other than outbound URL to understand which links are being clicked, this should be easily done by choosing a different click variable in GTM.

  10. jsn

    For the Trigger, I’m not seeing “Click URL” under the Fire When section when Im trying to create my trigger in Google Analytics… But I do see, “Page URL”…
    Have they changed this?

    • jsn

      never mind, I hadn’t set up the pre-defined variables…

  11. Michele

    What if the page is using a masked url? The page url reads as but this is a mask for the content of the site which is When we track the outgoing links the incoming referral on the other side is but it should be How do we make this happen? Hope I’m making sense!

  12. Thanks for the great post! I’m tracking my outbound links now 🙂
    The only clicks that are not being tracked are the ones made with the scroller or by right-clicking on the link and selecting “open in a new tab”.
    Is there anything I can do to track those as well?

  13. Sharif

    I know this article is a couple of years old, but the same apply today. I tried to do exactly as explained in this article and as in other tutorials on Youtube. But my issue is that my trigger keeps firing on all clicks even though I’ve set up “some clicks” and excluded my own domain in the trigger ,I.e “click url- does not contain –”…wha am I missing here? I spent all night trying to make it work 🙂

    Hope to receive a reply

    Thanks for a great article

  14. Hi Krista
    It’s a grate post for beginners simple steps easy to understand. It’s very helps for me to tracking outbound link in my website. Once again thank you.

Next ArticleBusiness vs Marketing Analyst - Roles, Skillsets & Career Paths