Main Image

Google Tag Manager 101 Part 3 - Creating Link Tags

UPDATED - JUNE 2020 - Setting up External Links

Welcome to Part 3 of the Google Tag Manager 101 series.

The Google Tag Manager 101 Series

  1. The Basics - setting up Google Tag Manager

  2. How to create a trigger and a tag

  3. Tracking links

  4. Social media tags

  5. Forms

  6. Timers and the real bounce rate

  7. The Datalayer

  8. CSS Selector

  9. YouTube Video Tracking

  10. Scroll Tracking

  11. Trigger Groups

  12. Non-Interaction Events

I recommend you start with Part 1 and work through the series in order to build your own Google Tag Manager container.

Firstly why do you need to build tags for mailtos and external links? Because these clicks will not be stored in your Google Analytics by default and because they may be indicators of engagement on your website.

Mailto Links

Create a trigger that looks like the one below. This will trigger for any link click on any page if "mailto" is in the link.

Some description

The tag we create will store a mailto link click as an event in GA. There is no right or wrong way to store the event details so you can choose the structure of data that you require. The most important thing is to be consistent from event to event so that when you want to build reports, it is easy to find the data that you need. We tend to follow the format below

Category: Top level event, there should be a small number of these which you drill into to determine the details of the event. In this case we choose "Mailto Link"

Action: In here we store the mailto link in full - this will show the email address that was selected.

Label: This records the page the user was on when the mailto link was clicked - if the mailto link is in the footer, for example, this will be useful to show when the footer link was clicked.

Some description 

You can also create Tel tags to record when people click on the Tel links on your website. These are increasingly used by mobile users to make a call.

External Links

New Method to Create External Links 2020

How to Trigger an External Link in Google Tag Manager?

Create an Auto-Event Variable with Element URL "Is Outbound" and 
fire the trigger when the variable is TRUE.

An issue with building a trigger for an internal link is that it is often difficult not to get false positives. In page actions can be set as links and fire the trigger. 

A more reliable method is to define an auto-event variable as below - set the Variable Type to "Element URL" and select "Is Outbound" as the Component Type.

Is Outbound variable

Now use this variable for your trigger

External link trigger

And that's it - easy to set up and more reliable.


Whenever I talk to a client for the first time about analytics, this question is always asked. "When a user leaves my website, can I tell where they go next?" Well if you build an External Link tag in Google Tag Manager then you will half the answer - where they go next if they click a link on your website.

Examples of Usage

1. You have a partner site on a separate domain to which you send web traffic. The partner site will see visits from your website as referrals - with an external link tag you will also know when somebody clicks on the link.

2. You have a set of links which you promote for 3rd parties - now you will know how many are clicked.

3. The vital part of your sales process actually sends the user to a 3rd party system to complete the sale (and they never return). Create the external link as a virtual page view and then set it as a goal - add the rest of your sales process as the funnel steps.

The trigger you create checks all links clicks on all pages and will fire if the domain does not match your own - replace "yourdomain" with a string that is included in your website URL. You should also add exclusions for any external links that you want to treat differently to avoid having 2 tags fire for 1 click. Exclude "mailto" if any email addresses on the site do not match the domain of the site. Exclude "tel" if you have Tel links. Exclude links to social media pages if you want to build separate tags to track these as social events (see Part 4 of the Guide - coming soon).

Some description

The tag that is created is similar to that for mailto links.

Some description

By now you should be able to create these triggers and tags quickly. Before you publish the container, go into GTM preview mode and confirm that the tags are firing when you click on mailtos and external links. You can also confirm in your GA test view that you see the events coming in from the Real-Time Events view. Once you're happy with the tags, you can publish and then monitor in the real world.

Go to Part 4 on Social Media tags. If you have any comments or questions, please fire them through.