Tools

How to Track External Link Clicks Using Google Tag Manager?

External links are links to a different domain. It takes the user from your website to other websites. In this article, I will help you to configure a Google Tag to track external links click on your website. Then see the reports in Google Analytics. What links are getting the clicks and from which page of the site.

This tag is not only helpful in understanding which links are getting the clicks but one can even measure the amount of traffic being sent out. Moreover, it also shows which links from which pages are getting the clicks.

So let us begin.

Step 0: Pre-requisite

You should be aware of Google Tag Manager Lingo. Moreover understand what is a trigger, tag, and the built-in variables available.

The next is, you should have a Google Tag Manager for tracking site’s traffic in Google Analytics. Though it is not a must, we will still need to have the Google Analytics Property ID to be able to send link clicks data to Google Analytics.

If you aren’t sure, refer to my article – How to Connect Google Analytics With Google Tag Manager first and then continue with this article.

Step 1: Create Trigger

We create a “Click Links” Trigger in Google’s Tag Manager and fire it based on the value of the link clicked.

  • Trigger name: Anything that you think will help you understand as the name of the trigger. I have it as “External Link Clicks
  • Trigger type: We want to have a trigger for link clicks on our website. So we choose  “Click – Just Links
  • Trigger fires: “Some Link Clicks” and select “Click URL” > “does not contain” > “yourdomainname.com”

Note: Replace “yourdomainname.com” with your domain name.

Note 2: Click URL may not be available in the drop-down. Add the variables by selecting the “Choose Built-In Variable …” option and select the variable.

This trigger will fire for link clicks on your website when the url is not from your choice of domain. It means your tag will fire and send data to Google Analytics when an external link is clicked on any pages of your site.

Points to consider for tracking clicks:

  1. The above trigger works fine for relative URLs or even # base anchor URLs.
  2. Email links, telephone links or WhatsApp links, may be treated as external links. If you don’t want to see these link clicks being tracked as external links in Google Analytics events report, you may need to add an extra check.
  3. Old style JavaScript-based URLs may be treated as external link. So if you want, it may be needed to be excluded from the trigger.

Step 2: Create a Tag For the Trigger

Create the external link click tag with the following metrics.

  • Tag name: Anything that helps you identify the tag in the future. I have it as “External Link Click
  • Tag type We will be using Google Analytics for our external link click. So we use “Google Analytics – Universal Analytics
  • Track type: Event (Selected from the drop-down menu list)

Event Tracking Parameters

  • Category: External link
  • Action: {{Page URL}}
  • Label: {{Click URL}}
  • Value: Leave blank
  • Non-Interaction hit: False
  • Google analytics settings: {{Google Analytics ID}}

Click Save. The {{Page URL}} and {{Click URL}} are built-ins variable that will send the needed data to Google Analytics.

You can either type the variable name or can even select from the list by clicking on the lego button beside it. If you don’t see those variable in the list of variables, there is + sign in the upper right corner to add one.

Track Your Tag in Google Analytics

Sign in to your Google Analytics account and click Behavior > Events > Overview.

Here we will see the data we have added in the tag. We had the category as “External Link” in step 2 when creating the tag.

Under the External Links event category, we will see the event label with all the links that are clicked by users.

If you wish to see for each link which pages on your site have generated the outflow of traffic, just click the links in Event Label and it will show a report of pages from where the links were clicked.

To view the overall pages where the external links are getting clicks, use the event action link as shown in the image below.

Step 4: AMP External Link Tracking

If you wish to track external link clicks for AMP pages on your site as well, you will have to create the same triggers for the AMP container separately in Google Tag Manager.

Shabbir Bhimani

Blogging Since 2009. If I can leave my high paying C# job in an MNC in the midst of global financial crisis of 2008, anybody can do it. @BizTips I guide programmers and developers to Start and Grow an Online Business. Read more about me here.

Recent Posts

Absolute Beginners Guide to Google Ads

Free Google Ads Tutorial for an absolute beginner covering campaigns and their types, networks, keywords,…

2 years ago

How Freshers Can Make Money Programming in Java

Do you want to make money programming in Java? Here are 6 creative ways for…

3 years ago

Financial Freedom for Freelancers – 9 Smart Ways

9 smart ways for freelancers to achieve financial freedom. First, you have to believe it…

3 years ago

How To Become A Self-Taught Developer

With so many programming languages and resources available, it can be information overall to learn…

3 years ago

Wise Review – Best Exchange Rates For Indian Freelancers

Wise review from an Indian freelancers point of view to receive payments in India. How…

3 years ago

How to Tell a Client you Can’t Lower the Price?

There are 3 types of clients who want you to lower the price. How to…

3 years ago