Tracking Outbound Links with Google Tag Manager


Posted on December 15th, by Jay Murphy in Digital Marketing. No Comments

Use Google Tag Manager’s to track Outbound Links

This blog article is a follow-on to an earlier article that showed how to Track PDF downloads in the latest version of Google Tag Manager (V2).  This blog will show the same approach used for tracking outbound links – to either an Google Analytics Event or to a Virtual Page View.

Login into your Google Tag Manager account and click on the New Variable button – to make sure you will have access to the “Click URL” variable, click on the check box next to the “Click URL”. We will be using this variable to determine whether this is an outbound link.  (We also make the Click Text variable available as well – since it can sometime be a clearer value in the final reporting.  Keep in mind that every variable adds a little bit more JavaScript on your users browser.)

select variables in new google tag manager ui

Create an Outbound Link Click Trigger

Next we need to set up our Link Click Trigger to track outbound links.  First select

Create a Trigger

Select the ‘Click’ trigger from the type and then specify a ‘Link Click’.  This creates code that will listen for when users click on a link, next we will tell the trigger to fire when the link is to a PDF file.  We do this by setting up a rule:

Click URL

does not contain

mycoolwebsite.com

GoogleTagManager-Outbound-Link-Trigger

If your URLs have different structures – you can use the technique from Simo Ahava that uses the hostname of the URL – http://www.simoahava.com/gtm-tips/track-outbound-links-in-gtm-v2/.

Create the Event Code

Just like in our PDF download example we can create an event to track the outbound links. This tag is a Universal Analytics tag that will look like this:

Google Tag Manager Outbound Link Tag Configuration

You can define the Category, Action and Label as you see fit, my preference is as follows:

Category: Outbound

Action: link

Label: {{click Text}} or {{click URL}} depending on which variable will best describe the link in your reporting.

Alternate Create a Virtual Page View

In some cases you might want to create a virtual page view instead of an event.  In this case your outbound links will appear in your Behavior reports.  Keep in mind that you will be affecting the pageview count for the website.

Your Tag in this case will be a ‘Pageview’ tag and the Document URL field will be updated with the {{click URL}} or {{click Text}} again depending on what best describes the link.  The Tag will be setup like this:

Document URL: {{click URL}}

Outbound Link Virtual Pageview Tag Configuration

 

As you can readily see whether you opt for tracking using an Event or a Virtual Pageview – this approach quickly scales.

As soon as you publish this tag you will be tracking your outbound links!

Hope you find this post informative and let me know other topics you would like to cover.

Be Sociable, Share!




Leave a Reply

Your email address will not be published.

wordpress Wordpress Theme