Where’d They Go? Track Every Exit Click Using Google Tag Manager in 10 Steps

Andy Crestodina

It’s hard building an audience. Think of all that work that goes into attracting visitors. But what about keeping them? Did we encourage them to stick around? Or did we squander the opportunity and show them the door?

They came, they read …they left. It may be happening on your site right now.

Not every exit is a bad thing. Sometimes it’s a fond farewell. The visitor bought something or became a lead and it’s time to move on. Other times, it’s bad. They leave right before they took action. Or they left because we suggested they leave.

Why do your visitors leave? Which exit links are they clicking? In this post, you’ll learn how to track website exits and offsite links. And in the process, you’ll learn how to set up event tracking with Google Tag Manager.

Tracking the three types of website exits

Visitors leave websites in three ways.

  1. They close the browser tab (or type another website into the address bar)
  2. They hit the back button
  3. They click on an offsite link or button

The first two are natural and impossible to avoid. But the third exit is different. It’s something you added to your website, during design or when publishing content. You put that exit sign there. You built that off ramp.

In Analytics, all three exits look the same. Yes, the exit page report shows the last page they visited. But there is no report in Google Analytics for tracking clicks on the exit links!

We’re fixing that today.

Let’s learn step-by-step how to track every click that takes visitors off of your website. We’ll do it by setting up event tracking and offsite link clicks using Google Tag Manager.

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

Here’s how to track all the clicks on all the links to other websites. We’re going to use Google Tag Manager (GTM) to set up event tracking. Hopefully, you have GTM setup. If so, you can just follow the steps below. If not, call your developer.

First, we’ll create a tag, then we’ll create a trigger for the tag. Finally, we’ll publish these to the live site.

  1. Log into Google Tag Manager
  2. From the Tags section, click NEW

off-site-links-top

  1. Name your tag. I called mine “Offsite Link Event Tracker” Then click to choose the tag type.

tracking-off-site-links-2

  1. Select either Universal Google Analytics or Classic Google Analytics.

Note: If you aren’t using Universal yet, you should strongly consider switching. Google isn’t going to support Classic forever!

tracking-off-site-links-3

  1. Enter your Google Analytics Tracking ID
  2. Select “Event” from the Track Type dropdown

tracking-off-site-links-4

Don’t have your GA Tracking ID memorized? Who does, right? Look up it up in the Property > Tracking Info > Tracking Code section of the Google Analytics Admin area.

tracking-off-site-links-12

ProTip: Use a text-constant variable, such as {{Google Analytics Property ID}} instead of your specific tracking code for more flexibility later. Learn more about this here.

  1. Set your event parameters. All events in Analytics have three main parameters: Category, Action and Label. The beauty of Google Tag Manager is that you can just type these right into boxes. No need for help from a programmer.

We’ll set the category to “link”, the action to “click” and the Label to “Click URL.”

tracking-off-site-links

You’ll also have the opportunity to add a value to this event, but it is unnecessary for event tracking offsite links.

Note: if Click URL is not available, you’ll need to first enable the Click URL variable. It is a built-in variable, but it’s not enabled by default. It’s easy to do. Just go to the Variables section, click the red Configure button and then check the “Click URL” check box

tracking-off-site-links-6

  1. Next we’ll 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.

tracking-off-site-links-10

  1. Name your trigger. I called mine “Offsite Link Click” Then click to choose the trigger type. Select “Just Links” as the type.

tracking-off-site-links-5

  1. You’re almost done. Now we just need to tell 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. That’s exactly how you set the triggers in the event.

tracking-off-site-links-8

…then click “Save.”

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

Before we look to check our exits in Analytics, we should explain something: This event tracking will affect our bounce rates.

This is because a bounce really isn’t a one-page session. A bounce is a one-hit session. A hit is any time data is sent to or from Analytics. Events are hits.

So if a visitor lands on 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.

So now I can track every click that leaves my site?

Yes! They’re waiting for you in the Event report in Google Analytics. Let’s go look. We’ll answer three, previously unanswerable questions.

1. Where are they going?

To see where your off ramps lead, go to Behavior > Events > Top Events. From here you’ll need to get to the “Event Label” dimension.

Remember when we set the event category, action and label? Those are the dimensions in this report. We set the category to link, the action to click and the label to be the clicked URL. So to see where visitor went (the clicked URL) we need to see the label.

You can get to this primary dimension by clicking “Event Label” at the top of the report.

tracking-off-site-links-7

You are now looking at a list of all the websites that you send traffic to. This is the opposite of your referral sources report! These are the sites for which you are a referral source.

2. Where did they leave from?

To see which pages have the off ramps that are getting clicked, go to Behavior > Events > Pages.

tracking-off-site-links-9

You are now looking at a list of all of your pages from which visitors click to leave. Not back button clicks or closed browser tabs. You have at least one exit link on each of these pages.

3. Which exit link did they click on from a specific page?

Now we’re going deep. This is real analysis. Because as usual, the best insights are one level deeper than whatever report you’re looking at.

Here’s an interesting question: which exit links are getting clicked on the home page? To answer this question, just click on the page, then set Event Label as the primary dimension.

tracking-off-site-links-11

The insights from these three reports should be obvious…

Wow, I’m giving up a lot of my visitors!

We all do. But remember, not all exits are bad. In the next post, we’ll share a complete guide on website exits, good and bad. And for those bad exits, we’ll give you tips for keeping your visitors around a bit longer.

But for now, here are three high-value, related posts keep your visitors on your site and flowing well.

Big thanks (and an exit link) to the good people at E-Nor, who wrote Google Analytics Breakthrough, the book where I first found this technique. Highly recommended!

What are your thoughts?

By signing up you agree to our Privacy Policy.

Comments (14)
  • Thanks for writing this. It looks like Google recommends GA4 rather than UA IDs now. How do you do this with GA4 IDs?

  • More than good enough 🙂 , super helpful Andy.

  • Ok. So you can get all of this radical information from the Tag Manager. Can you create audiences in Google Analytics based on the information these custom tags produce? I’m a bit new to all of this.

  • Thank you so so much. This was just terrific, I have been wondering how to set up links on wordpress woo commerce product and profolio pages …. you guys did a great job explaining to me how to do it, so thanks again.

  • Nice article, now is 2020, and it still works!

  • This is great stuff and often overlooked! Thank you for the information.

  • Really useful.
    If you did want to leave it to include bounces I wonder if there were a way to create a custom metric so you could evaluate those who exited from a link too, exit link clicks/visits to a certain page.
    Just a thought.

  • Great tutorial! Ifwe set up all exit links to open in a new tab, that will allow visitors to both stay on our site and also view the new site.

  • Great job Andy! This is so useful as I’m looking at outbound link for a number of clients now.

    Here is a custom report I created that shows the Page, Category, Action and Label all in one place. It helps make the analysis a little easier.

    Click here and add to your Google Analytics property >> https://analytics.google.com/analytics/web/template?uid=Bn092JHgSfmSzkh2Mu5GtA

  • Awesome post Andy! Just set this up for my site.

    For anyone with a WordPress site wanting to setup Google Tag Manager without needing to talk to a developer, this plugin makes it pretty simple: https://wordpress.org/plugins/duracelltomi-google-tag-manager/

  • I’ve been getting into GTM for a lot of clients lately. Such a cool free tool. Great job on this – there are not enough good resources out there for the current iteration of GTM and it can be a bit confusing as you get started!

  • Nice post (as always) Andy. For those who ARE concerned about the change to Bounce Rate, when you’re configuring your Tag, right underneath the box for Value should be a drop-down titled “Non-Interaction Hit”. It defaults to False, which will affect the Bounce Rate just as Andy describes above. But if you change it to True, then the Hit of the Event will not stop the session from being a Bounce (if that was the only page viewed during the session–otherwise it wouldn’t be a bounce anyway).

    Of course, depending on the nature of the links on your site, you might be considering people clicking on them to be interactions anyway, and that therefore they should NOT be bounces. It really depends on the nature of the links on the page. Someone who clicks the E-Nor link in Andy’s post above clearly has read through the post pretty thoroughly, and is exploring further. I would not consider that a Bounce even if it was the only page in the session. So in this case, your Bounce Rate just got more accurate!

    But if your external links do indicate that your content “failed” the user, you could set that Non-Interaction Hit flag to True so that the Bounce Rate is not affected.

    • I love you, Tom.

      • Andy –
        Is this only going to track the outbound links on our website? Is there a way where I can see when someone exit my website, which website did they go to. Like for example if someone exit from my website http://www.xyz.com and then go directly to different website either putting the website address in the browser or going to google search engine to search for the website.

        Thanks!

 
Join over 16,000 people who receive web marketing tips every two weeks.

By signing up you agree to our Privacy Policy.