How to track Internal and Outbound link clicks in Google Tag Manager
In this post I’ll show a method to track Internal and Outbound link clicks using Google Tag Manager. This will allow you to see which links your website visitors are clicking on and how they navigate on your site.
You can also check out the next post; How to measure Internal and Outbound link clicks in Google Data Studio. In that article I look at how you can monitor these link clicks using Google Data Studio.
Before we begin, just to make sure we’re clear on the definitions;
- Internal links – an internal link is one that points to another page on the same website.
- Outbound links – an outbound link is one that points to a page on a different website.
The method to set them up in Google Tag Manager (GTM) is similar, and I’ll go through them one by one.
Creating an Internal Link Tag in GTM
First click to create a new tag.
Then choose a Google Analytics type tag.
Then set up your tag as the following;
Track Type = Event
Category = Navigation
Action = Internal Link Click
Label = {{Click URL}}
Google Analytics Settings = Your GA tracking code
PS – you may need to configure the Click URL variable in order to add it to this tag.
And now we need to create our Internal Links trigger.
We need to choose the Click > Just Links trigger type. Then you should set it up to fire on ‘Some Link Clicks’.
Then set the following conditions; Click URL > contains > [your website URL].
We can name this trigger “Internal Link Clicks“. Now we have our tag, which I have named “GA – Event – Internal Link Clicks“.
Once you’ve set up the trigger, we now have our Internal Link click tag fully created and ready. Next step is to create one for external links.
Creating an Outbound Link Tag in GTM
Follow the same steps as you did in setting up the Internal Link tag. Also choose to create a Google Analytics Event tag.
Then set up your tag as the following;
Track Type = Event
Category = Navigation
Action = Outbound Link Click
Label = {{Click URL}}
Google Analytics Settings = Your GA tracking code
Then create a Click > Just Links Trigger. Set it up as shown below.
We can name this trigger “Outbound Link Clicks“. Now we have our tag, which I have named “GA – Event – Outbound Link Clicks” and our trigger to measure these clicks.
We now have our both our internal and outbound link tags set up. The next step is to test them.
Testing your Internal and Outbound link click tags
The first thing to do is to enter Preview Mode in Google Tag Manager.
Now go and click on an outbound and an internal link on your website. You should see both tags firing in Google Tag Manager.
The next step is to confirm that the data is appearing correctly in Google Analytics.
Go to Google Analytics (preferably to an unfiltered view where your own IP address is not excluded) and click on Real Time > Events.
Then click on some outbound and internal links. If everything is working correctly you should see them appear in Google Analytics.
Hope you enjoyed this post tracking Internal and Outbound link clicks using Google Tag Manager.
My Other Blog Posts
If you liked this article you might like my other blog posts.
very useful article thank you, Michael. Would it be possible to do this only on the home page ?
Thanks Nicolas! Yes. You could set the tag to fire only on specific pages, then choose only the homepage. So on your Link click trigger, you could set the conditions to include only fire when the page URL = homepage.
Great guide, Michael – very helpful. Is it possible to exclude certain pages? Example – the ones I’ve set to noindex. Thanks
It should be possible to exclude certain pages in Google Tag Manager when creating the tag. But I haven’t tried that myself.
If you have several outbound links on a particular page and you want to see which of those links are being clicked, is it possible to set up? Thanks.
Good question, don’t know the answer to that off the top of my head though. I haven’t tried that yet.
Awesome post.