When a user clicks on an external link he is redirected to another domain and you may think that you have lost a user. But, imagine a scenario where the user is clicking on external links which redirect him to your social media profiles such as your Facebook page, Twitter account, YouTube channel, LinkedIn profile, etc.
In such a case, the user is interested in the content that you have shared across your social media profiles and wanted to keep updated about your site. He might have wanted to subscribe and like your content.
Let’s take another example. Suppose you have multiple domains (websites) which have links to each other. In this case, you would like to know how many times the user is navigated between the different domains you own.
Tracking outbound links provides you with important information about the user’s behavior on your website and how he is leaving the website.
One more example. Suppose you are a tech blogger and you provide reviews about the latest gadgets available on the market. As a source of income, you also carry affiliate marketing and provide links to different websites where the user can go and purchase the product. In this case, you would like to see how many users came to your website, read the content and then navigate to one of these websites to make a purchase.
Tracking outbound links using Google Tag Manager
If you use Google Tag Manager for your analytics implementation, it is very easy to set up outbound link tracking. This method is the most recommended since you do not need to write any code for every outbound link.
Imagine you have more than ten outbound links on your website. If you are not using Google Tag Manager then you will need to add code for every link using the ‘onclick’ function and additional analytics script.
To track outbound links using Google Tag Manager you need to carry the below activities.
Create an auto event variable
Create a trigger
Create a tag
Debugging and validation
Creating an auto event variable
The first thing to do is to create an auto event variable which is nothing but a variable that captures information about the link click and returns true if it is an external link (outbound), else it returns false if it is an internal link.
Follow the below steps to create an auto event variable.
Step-1: Navigate to your GTM container and click on ‘Variables’.
Step-2: Now scroll down and click on ‘New’ under ‘Use-Defined Variables’.
Step-3: A new window will pop up like below, give it a proper name and click on ‘Variable Configuration’.
Step-4: Click on ‘Auto-Event Variable’ from the variable configuration list.
Step-5: Now click on the drop-down under ‘Variable type’ and select ‘Element URL’
Step-6: Now click on the drop-down under ‘Component type’ and select ‘Is Outbound’.
Step-7: Now you need to provide the list of ‘Affiliated Domain’. Affiliated domains here refer to the list of your internal domains. If you want to add other domains as internal you can add them here as a comma-separated list. The variable will return true if the URL does not match with the current page’s domain or the list provided in affiliated domains.
Note: The auto event variable by default considers subdomains as external, so if you want to add your subdomains as internal you need to specify it in the ‘Affiliated domains’ list (for example blog.example.com).
Follow the below steps to create a trigger for tracking outbound links
Step-1: Click on the ‘Triggers’ menu.
Step-2: Click on the ‘New’ button.
Step-3: Give your trigger a valid name and click on ‘Trigger Configuration’.
Step-4: Select the ‘Just Links’ trigger type.
Step-5: A new configuration window will appear like below. Select the radio button ‘Some Link Clicks’
Step-6: Now select the auto event variable that we created earlier from the first drop-down under condition.
Step-7: Select the ‘equals’ operator in the second drop-down and type ‘true’ in the input box provided.
Step-8: Your final trigger will look like below. Click on ‘Save’
Now, let’s move to create a tag for tracking outbound links.
Creating a tag
Follow the below steps to create a tag for tracking outbound links.
Step-1: Click on ‘Tags’ in the left-hand side menu.
Step-2: Click on ‘New’.
Step-3: Give a proper name to your tag and click on ‘Tag Configuration’.
Step-4: An overlay will appear on the right-hand side with a list of tag templates. Select ‘Google Analytics: Universal Analytics’.
Step-5: Click on the ‘Track Type’ drop-down and select ‘Event’.
Step-6: Now under ‘Event Category’ type ‘Outbound Link Click’.
Step-7: Now click on the plus (+) button next to ‘Action’.
Step-8: Select the ‘Click Text’ variable as an event action. This will provide us details about what was text clicked when the user was leaving the website.
Step-9: Now click on the plus (+) button next to ‘Label’ and select the ‘Click URL’ variable.
Step-10: Now select the Google Analytics settings variable.
Step-11: Now click on the ‘Triggering’ option available below the tag configuration.
Step-12: Now select the trigger that we have created earlier.
Step-13: Click on ‘Save’.
Congratulations! You have successfully set up outbound link tracking. Now it’s time to check the implementation.
Follow the below steps to debug and validate the implementation.
Step-1: Click on the ‘Preview’ button (on the top right-hand side) in Google Tag Manager.
Step-2: A new window will open with Google preview mode. Add the URL of your website where external links are present and click on ‘Start’.
Step-3: Another new window will open with the specified URL.Now click on any of the external links and navigate back to the preview window of Google Tag Manager. You should see the outbound link click tag has fired.
As an example, I have created an external link to Facebook and we will test that here.
You can click on the tag to see more details.
Tag Details
Firing Triggers
Step-4: Now click on any of the internal links and validate if the outbound link tag fires or not.
It should not fire on any of the internal links or the list of domains that we provided in the ‘Affiliated domains’ while creating the auto event variable.
You can further check the firing trigger to validate. As you can see in the below image the auto event variable is not true (since it’s the internal link click) and hence the tag did not fire.
So this is how you can debug and validate the outbound link tracking events. You can further log in to Google Analytics and check it in ‘Real-time’ reports as well.
Once you have published your container you will start recording the outbound link click events. You can check it under Behavior > Events > Top Events.
Frequently asked questions about how to track outbound links in Google Analytics
What is an outbound link?
An outbound link is also called an external link. It is a link from your website domain to a different website domain. For example, if your website domain is ‘abc.com’ then all the links that do not contain the ‘abc’ domain will be considered outbound links.
Why is tracking outbound links in Google Analytics important?
While browsing on the website, a user may come across multiple outbound links and he might click on them and leave the website. To know the user behavior and how they leave the website, it is very important to track the outbound link clicks.
Perhaps they might be clicking on the external links like your own social media pages or other domains that you own.
How to track outbound links using Google Tag Manager?
To track outbound links using Google Tag Manager you need to follow the below steps:
1. Create an auto-event variable in Google Tag Manager with ‘Variable type’ as ‘Element URL’, ‘Component type’ as ‘Is Outbound’ and a list of ‘Affiliated domains (domains you own)’.
2. Create a trigger with ‘trigger type’ as ‘Clicks-Just Links’, and in condition add the ‘Auto-Event Variable’ equals to ‘true’.
3. Create a tag with ‘tag type’ as ‘Google Analytics: Universal Analytics’, ‘track type’ as ‘Event’ then add ‘Event Category’ as ‘Outbound Link Click’, ‘Event Action’ as ‘Click Text’ variable, and finally ‘Event label’ as ‘Click URL’ variable.
4. Save the tag and click on the preview to debug and validate,
5. Once verified you can publish the container.
Register for the FREE TRAINING...
"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."
Here’s what we’re going to cover in this training…
#1 Why digital analytics is the key to online business success.
#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.
#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.
#4 Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.
#5 The number 1 reason why conversion optimization is not working for your business.
#6 How to advertise on any marketing platform for FREE with an unlimited budget.
#7 How to learn and master digital analytics and conversion optimization in record time.
My best selling books on Digital Analytics and Conversion Optimization
Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.
Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.
Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.
Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.
About the Author
Himanshu Sharma
Founder, OptimizeSmart.com
Over 15 years of experience in digital analytics and marketing
Author of four best-selling books on digital analytics and conversion optimization
Nominated for Digital Analytics Association Awards for Excellence
Runs one of the most popular blogs in the world on digital analytics
Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Allow Cookies”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.