• Jervis Koo

Track Every Website Exit Using Google Tag Manager

Building an audience is a big challenge and there's a lot of work that goes into attracting visitors. But what about keeping them and how do we encourage visitors to stick around?

They came, they read …they left and never returned. Not every exit is a bad thing, sometimes a visit led to a subscriber or a purchase and it's time they moved on. More often than visitors leave right before taking an action.

Why do your visitors leave? Which exit links are they clicking? In this post, we’ll learn how to track website exits and offsite links using Google Tag Manager.

Tracking the three types of website exits

There are three ways visitors leave websites;

  1. Closing browser tab

  2. Hitting the back button

  3. Clicking on an offsite link or button

The first two are natural and impossible to avoid but the third type of exit is different. Offsite links are links that are added to our website, during design, or when publishing content. We put that exit sign there.

In Google Analytics, all three of these exits look the same. The exit page report does show the last page they visited, however, there are no reports for tracking clicks on the exit links.

We’re fixing that today!

How to set up exit link clicks tracking with Google Tag Manager

1. Log into Google Tag Manager

2. Create a new tag

3. Give your tag a name and select your tag type.

4. Select Universal Google Analytics

5. Enter your Google Analytics Tracking ID

6. Select “Event” from the Track Type dropdown

7. Set your event parameters. All events in Analytics have three main parameters: Category, Action, and Label.

Type in your category and action (check out Google's guide for best practices if you need help with naming conventions) We’ll set the category to “link”, the action to “click” and select “Click URL" as the Label.

Note: if Click URL is not available in the drop-down, this needs to be enabled. It is a built-in variable but not enabled by default (annoying, I know!). No fear, it takes a few simple clicks to get this enabled. Head to the Variables section, click the red Configure button and then check the “Click URL” checkbox. Done!

8. The next step is to create a trigger for our event. You can do this from within your new tag by clicking to “Choose a trigger to make this tag fire.” Click the plus sign in the top right to create your new trigger.

9. Name your trigger then click to choose the trigger type. Select “Just Links” as the type.

10. Now we just need to set up the trigger to fire whenever an offsite link, to another domain, is clicked. In other words, fire the trigger when the Click URL does not contain your website.

Side note: Here’s what you didn’t know about bounces

Before we check our exits in Google Analytics, it's important to note that this event tracking will affect our bounce rates.

The reason for this is because a bounce is not a one-page session. It's a one-hit session. What does that mean? A hit is any time data is sent to or from Analytics. Events are hits.

So when a visitor lands on a page and clicks an offsite link before visiting a second page, they will no longer be counted as a bounce, since it was a two-hit session. The first hit was the pageview and the second hit was the event.

Do we care that our bounce rates will look a bit lower now? Not really. We’re about to get some much more valuable insights.

Are we all set up to track exit links?

Yes! You can start reporting on exit links in the Event report on Google Analytics. By having this setup, we're now able to answer some key questions;

Where are users going?

To find out where our users are exiting, navigate to Behavior > Events > Top Events on your GA dashboard. On the "Top Events" report, select "Event Label".

By setting up the event category, action, and label in Google Tag Manager, these dimensions are now visible on this report in GA. By setting the category to 'link', the action to 'click', and the label to be the 'clicked URL', we're able to see where visitors are exiting to (clicked URL) by selecting the 'event label'.

This report shows us a list of websites that we send traffic to. This is the opposite of our referral sources report. These are the sites for which our website is the referral source.

Where are users exiting our website?

To get a list of the pages where our visitors click to leave, go to Behavior > Events > Pages.

Which page was the exit link clicked on?

We can find this out by diving deeper into our analytics.

To answer this question, just click on the Behaviour>Events>Pages on the Google Analytics menu, then select Event Label as the secondary dimension.