Track outbound link clicks in Google Analytics with GTM

The Google Tag Manager gives you the possibility to track every click on your website. When you would like to know which outbound link clicks gets most of your traffic it is useful to save every external link click as an event in Google Analytics.

We need the GTM built-in variable Click URL to check if our outbound link meets our conditions. We have to activate this first.

built-in variables clicks

Create a new Trigger based on a Click. Don’t check Wait for Tags or Wait validation. Fire this trigger when the Click URL does not contain

event outbound link click

Update: Due to the comment of Simo you can mark the next words as unwritten 😉

When an url is relative, for example, href="../index/", then it’s an internal link. We would not like to track these. Absolute (outbound) urls are always starting with http://, // or https://. We are going to check this with a RegEx.

Use this regex to check if a link starts with http:// or // or https://.

When you are creating Regular expressions on your own, you could test them with

When our trigger is set, we could use it for firing our Google Analytics tag.

Google Analytics external click1

External clicks will now be recorded in Google Analytics :)

Google Analytics Events

Was it interesting? Share it, so someone else can read this too!Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

6 thoughts on “Track outbound link clicks in Google Analytics with GTM”

Leave a Reply

Your email address will not be published. Required fields are marked *