How to Track Outbound Link Clicks with Google Tag Manager

  • 4 years ago
Users come and go and knowing where they exit can be just as important as where they went in. Knowing what links users click brings valuable data on user behavior on your website. This will give you, as a webmaster, ideas on ideal locations to place links and anchor texts that will draw them to click. This can be helpful especially if you participate in affiliate programs or you want users to land on your social media pages and other specific websites.


Six years ago, I wrote an article about How to Track Outbound Links using Google Analytics. Unfortunately, that won’t work anymore today as it uses the old Google Analytics Tracking code (ga.js) and the best alternative way to do this right now is to use Google Tag Manager.

Google Tag Manager might be intimidating to use but it is one of the most useful tools for SEOs. It can help you in organizing all tracking codes that you place on your website in one place. If you want to unlock one of the secrets on how users behave in your website, Google Tag Manager can help.

In this blog post, I’ll be showing the step by step procedure of setting up outbound link tracking using Google Tag Manager. Take note that you need to set-up Google Analytics with your Google Tag Manager Account for you to see the data.Log in To Your Google Tag Manager Account

1. Log in to Your Google Tag Manager Account
If you haven’t set up Google Tag Manager, I highly recommend you follow this Google Tutorial: Setup and install Google Tag Manager.



2. Go to Variables and Click New Under User-Defined Variables


3. Select Auto-Event Variable Under Variable Type
You should also name the variable to something like Outbound Links Variable so it won’t cause confusion when you set up other variables for other tracking you’ll create. Under the 2nd Variable Type selection, select Element URL and under Component Type select Is Outbound. Save your variable. This will automatically treat all links outside of your domain as outbound links. If you have subdomains or other websites you own that you don’t want to treat as outbound links, put them under Affiliated Domains.





4. Go to Triggers and Create a New One
Name it Outbound Links Trigger or whichever you prefer.



5. Select Click – Just Links Under Trigger Type
Select Some Link Clicks and then an option will appear to select a variable. Select the variable that you created earlier, select equals on the second box, then input true on the third box.





6. Go to Tags and Click New


7. Under Tag Configuration Select Google Analytics: Universal Analytics
7.1. For Track Type, select Event

7.2. For Category, select the Outbound Links Variable you created

7.3. For Action, select Click URL

7.4. For Label, click the plus sign and select Click URL

7.5. If you want to set a value for each click (maybe for affiliate links), you could set it under Value.

7.6. Select True under Non-Interaction Hit



8. For Triggering, select the Trigger that you Created Earlier