Last updated on
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. Under the 2nd Variable Type selection, select Element URL and under Component Type select Host Name. Save your variable.
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
Make sure to select the Wait for Tags and Check Validation boxes. For Wait for Tags, leave it at default (2,000 milliseconds).
5.1 Under Check Validation, select Page URL, matches RegEx, and the symbols :* (colon and asterisk).
5.2. Under This trigger fires on, select Some Link Clicks and on the following boxes select Click URL, does not contain, and your domain name. This is to avoid triggers when people click links on your website’s pages that will land inside your website.
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
9. Save the Tag and Click Preview Mode
After you’ve entered preview mode, open a new tab and go to your website. A small window should appear below and it will show you the summary of the tags that fired on that page.
Try opening another page or a blog post that has links to other websites. Click one link and go back to your site. In the Google Tag manager window, you should see under Summary that the Outbound Links Trigger that you created fired.
Viewing it in Google Analytics
To view the data, go to your Google Analytics account and in the sidebar click Events under Behavior. If you want to see the specific pages where people clicked an outbound link, go to Pages.
Click the page you want to see and click Event Category and Event Action until you reach the list of outbound links that users clicked on your website.
Setting up outbound links tracking with Google Tag Manager can be done in less than 30 minutes and the results can be surprising. The data you can get from this process can be useful as a marketer or as an SEO. This can help in unlocking the key to user behavior on your website leading to better content and linking strategies.