It’s always helpful to understand where users are going from your blog. Such an understanding is absolutely essential if you need to direct them to one of your advertisers’ websites to encourage them to buy. After analyzing your outbound link clicks, you can calculate the conversion rate and evaluate how efficient your links are.
Why should you track outbound link clicks?
After checking the number of clicks on outbound links, here’s what you can learn:
- Calculate your conversion from website visitors to those who click the link to your advertiser’s website.
- Compare the effectiveness of links that lead to the same website but placed in different articles.
- Compare the effectiveness of similar links with different ones.
- Compare conversion for different advertisers.
Create events in Google Analytics to understand how many users go to third-party resources from your blog.
There are two ways to set events:
- Add the tracking code directly to your blog.
- Set up analytics via Google Tag Manager.
The second method is easier as you will only need to add the code once. Then you will be able to setup all events via GTM without changing the code on the website.
How to set up tracking of outbound link clicks in Google Analytics?
If for some reason you find it easier to track clicks directly in GA, here’s how you can set up tracking. First, connect your blog to Google Analytics (if you haven’t already).
1. Create a resource in GA. Find detailed instructions in Google’s guidelines.
2. Add the analytics.js tracking code to your blog pages. This code will look like this:
<!-- Google Analytics --> <script> window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)}; ga.l=+new Date; ga('create', 'UA-XXXXX-Y', 'auto'); ga('send', 'pageview'); </script> <script async src='https://www.google-analytics.com/analytics.js'></script> <!-- End Google Analytics -->
UA-XXXX-Y — your individual tracking code.
If you have already linked your blog to Google Analytics, be sure to set this tracking code exactly as the script we will discuss below only works using this code.
Tracking outbound link clicks in Google Analytics
To see internal link clicks on your blog, simply create a standard tracking code. To send data about internal link clicks to GA, after the tracking code
Add the following script to :<script> var trackOutboundLink = function(url) { ga('send', 'event', 'outbound', 'click', url, { 'transport': 'beacon', 'hitCallback': function(){document.location = url;} }); } </script>
Add the “onclick” attribute to the codes of these links on the page with a loaded script that you want to track clicks on.
<a href="http://www.example.com" onclick="trackOutboundLink('example.com'); return false;">Открыть example.com</a>
How to check that monitoring is working properly
- Go to Google Analytics, select “Real Time Report”.
- Select “Events” from the drop-down menu.
- Click on a few outgoing links on your blog.
- Go back to Google Analytics and see if these events appear.
How to set up tracking of outbound link clicks in Google Tag Manager?
If you want to manage all settings in Google Tag Manager, you can remove GA tracking codes from your blog after installing GTM. Your statistics in GA are not removed because you have actually changed the way you add Google Analytics to your website.
1. Install Google Tag Manager on your blog:
- Create a resource in Google Analytics.
- Create a container in GTD by following the instructions. Add the container code to your blog.

If your blog is running on WordPress, open the header.php file. First code right after the opening tag
Add to . Second code after opening tag add it to the directory.2. Enable built-in variables.
These variables are required to track link clicks.
- Select “Variables” from the left sidebar.
- Click “Configure” in the “Built-in Variables” section.

- Check the boxes labeled “Click URL” and “Click Text” in the drop-down menu.

3. Add the Google Analytics ID as a custom variable to the GTM. You can use it for all tags.
- Add the “Variables” menu item and click “New” in the “User Defined Variables” section.

- Specify a name for the new variable, such as “site name (your project name) analytics ID”. Click the pencil in the upper right corner to edit. Select the variable type: Google Analytics Settings.
- Add the tracking code from Google Analytics.

4. Set up page tracking via GTM:
- If the Google Analytics tracking code is installed on your blog or website, remove it.
- Create a new tag in Google Analytics. Tag type: Google Analytics – Universal Analytics; View Type: Page View; variable: site name analytics ID.
- Select “All Pages” in the Triggers section.
5. Create a trigger to monitor outbound links:
- A trigger notifies GTM that it is necessary to load a tag. In this case, a trigger is a click on the outgoing link.
- Select “Triggers” from the menu and click “New”. You can choose a trigger name such as “Outbound link click”.
- Select “Links Only” as the trigger type and check the “Some Link Clicks” box in the “This trigger triggers” section.
- In settings, “Click URL → Does Not Contain → enter your /your website or blog URL/”. This is only needed to monitor outbound links to third-party resources with this trigger.
- Save your trigger settings.

6. Create a tag to track outgoing links:
- The tag is loaded when the blog user clicks on an outbound link.
- Create a new tag of type Google Analytics – Universal Analytics using the site name analytics ID variable you created in Step 3 and the “Outbound link click” trigger.
- Fill in the label properties as shown below. {{Click URL}} and {{Page URL}} are built-in variables that you need to select from the drop-down menu.
- Track Type: Event
- Category: Outbound link click
- Action: {{Click URL}}
- Tag: {{Page URL}}
- Non-Interaction Hit: False

7. Publish the container:

8. Make sure everything is working properly:
- Open Google Analytics, select “Real time report”.
- Select “Events” from the drop-down menu.
- Click on a few outgoing links on your blog.
- Go back to Google Analytics and see if the events appear.
Do you track clicks on outbound links? Which method do you use and find best?
Support our work ❤️
If you enjoyed this article, consider leaving a tip to help us keep publishing great content.

























