How to Track Outbound Link Clicks with Google Tag Manager
Quick Answer: Log into your Google Tag Manager account, and go to the variables section. Click “New” under the User-Defined variables section, and select the Auto-Event variable. Go to Triggers, and create a new tag. Then, select “Click – Just Links,” under Trigger Type. Go to “Tags,” and click “New.” Under the Tag Configuration section, select “Google Analytics: Universal Analytics.” For the Triggering field, select the Trigger that you created earlier. Lastly, save the tag, and review it in Preview Mode. You should also check if it’s firing properly in your Google Analytics property. Check out our post below for a more in-depth guide.
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
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.