GTM & GA: Track all outbound links with one tag

We already did download tracking with one tag – now let’s use the same principles to set up outbound link tracking.

Step 1: Enable default variables.

We’ll use the same default variables that we used for downloads, so if you’ve already set that up, you’re all set. If not, enable {{Click URL}} and {{Click Text}}.
click_vars

Step 2: Set up the GA tag.

Let’s think about how this should look in GA:

  • Event Category: outbound linksThis value can be hard-coded in – the other two are dynamically populated by variables.
  • Event Action: Similar to downloads, the destination URL of the outbound link
    {{Click URL}} contains this value – easy peasy.
  • Event Label: Exactly like with downloads, I like to put the text of whatever the user clicked here
    {{Click Text}} fits the bill for this one.

With everything set up, it looks like this:
outbound_tag

Step 3: Create and apply the Trigger.

We’re going to go with the simplest setup for outbound links for now – we want to track:

  • …every time the user clicks
  • …on a link
  • …that does not point to mydomain.com

This is it:
outbound_trigger_mydomain
In a later post, I’ll get into some nuances there, but that should work in most cases. Obviously you’ll replace “mydomain.com” with whatever your domain is.

Step 4: Preview & Publish.

Obviously.

Step 5: See data in GA!

Here, I’m looking at the Behavior > Events > Top Events report. I clicked into the “outbound links” category, and I’m viewing the Event Action:
outbound_events

If you want to know where these clicks occurred, just add “Page” as a Secondary Dimension.

Resources

Whenever possible, I’m going to try to provide reusable resources that you can download and put into action right away.

GTM Container Export
(includes outbound link tracking only):
http://angelagrammatas.com/gtmtips/outbound_links_gtm_angela_grammatas.json”

Later this week, we’ll talk about how to implement this when your site spans multiple domains. With a little Javascript, you’ll make your trigger far more flexible, and begin to unlock even more power in GTM. Stay tuned…

One comment

Leave a Reply

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