Track Outbound Clicks in Google Tag Manager

This is a quick walk through on how to track outbound clicks in Google Tag Manager. There are a number of reasons to track outbound clicks in Google Tag Manager. For example, you want to fire an event for people clicking a download file. Maybe you want to track outbound clicks in Google Tag Manager to track social media clicks or clicks to Google Maps if you don’t iFrame them. These steps are very similar to tracking mailto clicks, in Google Tag Manager. This works for any internal site click for that matter.

What You’ll Need to Track Outbound Clicks in Google Tag Manager

  • You’ll first need your GTM container, code, created and placed on your site pages
  • You’ll also need a tag for your standard Analytics tracking code with an “all page” rule

How to Track Outbound Clicks in Google Tag Manager

1. Create “Link Click Listener Tag.” New > Tag > Name “External Click Listener” or Whatever > Tag Type: > Event Listener > “Link Click Listener:”
Track Outbound Clicks in Google Tag Manager

2. Add outbound click firing rule for all pages. Firing Rules > + add rule > select default “all pages” rule.

3. Set event to fire when certain outbound links are clicked. Firing Rules > + add rule > tick “create new rule” > name it something applicable like “downloads” or “map clicks” > {{event}} equals gtm.linkClick > click the + > {{element url}} contains maps.google > save:

How To Track Outbound Clicks in Google Tag Manager

** note that the element URL can be whatever you want to fire your event or conversion code

** as shared here, you can use the second rule as {{element url}} matches regex and paste the below to capture all file extensions for tracking downloads:

^.*\.(7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip)$

4. Add event tag to fire when the external click rule is met. New > Tag > Name “Maps Click” or Whatever > Tag Type: > Google Analytics > Universal Analytics > Paste Your Tracking ID (UA # from Analytics) > “Track Type > Event > Name Category and Action Whatever and set “Label” to {{element url}} > Firing Rules > + Rule > Select ONLY the rule created in step 3 > save:

Track Outbound Clicks in Google Tag Manager

 

5. Create version and publish your container.

That’s how to track outbound clicks in Google Tag Manager as events. You can also tie these to Goals in Google Analytics. You can also set a custom HTML tag type and fire any conversion code in step four.

You may also like...

2 Responses

  1. Tracy says:

    Hi! Good article. However, you neglected to talk about how to do this same thing in GTM v2, which is going to be different. Have you consider doing that or do you already have that article somewhere? ~t

    • Trevor Ayers says:

      Thanks, I’m holding on v2 until April. I want to see how they handle my rules, or triggers, when Google allows for migration. I’ve dabbled with v2 and the triggers for URLs containing doesn’t behave the same. I plan on reverse-engineering after migration. Love your team’s website BTW.

Leave a Reply

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