We’re as big an advocate of data-based marketing as anybody out there. In order to make informed marketing decisions, it’s important to track more than what a basic Google Analytics set up will give you. Did you know that with a combination of Analytics and Tag Manager it’s possible to track the engagement of almost any element on your website?
If you want to move beyond basic page-view analytics, one thing you may want to track is clicks on outbound links. Wouldn’t it be nice if Analytics just told you which external links people clicked on your site that took them away? While Analytics doesn’t do it natively, we can easily set it up in Google Tag Manager.
This will give you an idea of what types of content people are interested in and will let you evaluate if external resources you’ve linked are useful to your audience. It can also let you see if anyone clicks on things such as your social media links. Finally, if you’re working with an external partner on your content, tracking outbound links will give you data to show if you were able to drive traffic to their site.
OUTBOUND LINK TRACKING USING GOOGLE TAG MANAGER
Before you get started tracking external links you’ll need to make sure you have Google Tag Manager set up on your site. Then you’re going to set up some new variables and create a new tag and trigger set.
STEP 1: SET UP TAG MANAGER VARIABLES
Now we move into Google Tag Manager (GTM) for the rest of this setup. We’re going to ensure that the click variables we need are enabled and also set up a Google Analytics settings variable.
- In GTM, navigate to the Variables section.
- The top part of the Variable section is for Built-In Variables. In this section click the Configure button.
- In the menu that opens; scroll down and check:
- Page URL
- Page Path
- Click URL
- Next, you’ll want to create a user-defined variable to connect your Analytics account.
- In the User-Defined Variables section, click on the New button
- Name the variable GA – Settings
- For the variable type, scroll down to Utilities section and select Google Analytics Settings
- For the Tracking ID, enter the tracking ID from your Google Analytics property
- Click Save
STEP 2: CREATE A TRIGGER
In Google Tag Manager you’ll need to get up a new trigger to indicate when an external link was clicked so that the tag can be sent to Google Analytics.
- Click on Triggers in the left-hand menu and then click on the New button.
- Name the new trigger External Link Click and click in the Configuration box to set it up
- Choose Click – Just Links as your trigger type
- In the configuration box check both checkboxes
- Enable the trigger for all pages
Page URL matches RegEx .* - Select the Some Link Clicks radio button
- Fire the trigger when Click URL
- Does not contain mailto:
- Does not contain tel:
- Does not contain your domain
- Save the trigger
STEP 3: CREATE A TAG
- Click on Tags in the left-hand menu and then click on the New button.
- Name the new tag External Link Event and click in the Configuration box to set it up
- Select Universal Analytics as your tag type
- For track type, choose Event
- Category: External Links
Action: {{Click URL}}
Path: {{Page Path}} - Under Google Analytics settings, choose your existing GA settings variable
- Save the tag
You’ve now completed setting up external link tracking on your site. Publish your changes and soon you’ll see data start to populate Google Analytics. You can now use these events in dashboards and to set up conversion goals.
If you have any questions tracking outbound links in Google Analytics, please get in touch.