Google Tag Manager Logo

I have performed a lot of Google Tag Manager implementations for websites, and sometimes the most time consuming part can be getting your container up and running. Assuming I’m not running into any monthly hit limitations, I like to start out with a baseline of configurations by importing a GTM container template. This template contains all of the configurations like external links, downloads and page views that I like to use with any website implementation.

In this post, I will run through a base container template that you can use with your own website. I will caveat that all websites are different and not every configuration will apply. For example, you’ll see that I put YouTube interactions in here. Not everyone uses YouTube, so you may need to refer to other posts for instances like that. A lot of these configurations are based on articles you can find from all over the web, so I’m doing this in an effort to pull it all together.

I won’t go into every detailed configuration in this post. Instead, you will find a link at the end of this article to download the container, so you can import it into your own GTM account and see how everything is set up.


Page Views

If you’ve visited my blog before, then you probably already know how to set up Google Analytics page views in GTM. If not, then I’ve done it for you!

Tag: GA – All Page Views
All Pages
User-Defined Variable: 
CONST – GA Tracking ID

To get this working, you’ll want to copy and paste your Google Analytics Property Tracking ID into  the CONST – GA Tracking ID variable. if you’re using multiple properties to track your different website environments, then you’ll want to use a look up table instead and assign the tracking ID value based on the hostname. I personally like using multiple properties, but a lot of companies I work with have 1 property and multiple views set up for their different environments, so I set it up this way.

External Links

Tracking external links is a very common feature that you’ll likely want to track on your website. Google Analytics doesn’t track them out of the box, so it’s important to set this up with your website implementation if you’re not getting close to your monthly hit limit.

Tag: GA – External Links
Trigger: CLICK – External Links
User-Defined Variables: AUTO – Click Hostname

The main configuration I want to point out is the trigger. To get this tag working, you’ll want to update the AUTO – Click Hostname to not contain your hostname. For example, I have it set to ‘’ for my website. Setting it to not contain will also catch any subdomains that you may have set up. If you have other domains set up in this container, you’ll want to those conditions here as well.

In addition, you’ll see that I’m not including mailto, pdf or tel links. This is because I have other tags set up for those links, and I use a different event category for them to make reporting a little easier.

GTM External Links Trigger

GTM External Links Trigger

This method is adopted from Simo Ahava’s post on tracking outbound links in GTM.

Telephone Calls

I think this is sometimes one of those most overlooked tags I see on implementations. With mobile share and proficiency increasing everyday, it’s important to ensure that your telephone numbers are properly linked on your website. A lot of times, the native browser will link them automatically, but linking them also opens up the door for important data collection. For example, let’s say you own a restaurant and you have a phone number on your website. It’s pretty typical for a user to find your website to make a reservation, look up a menu or just flat out contact you. Tracking those interactions can help you better attribute this behavior back to your website.

If this is a conversion point on your website, don’t forget to configure a Goal in Google Analytics!

Tag: GA – Phone Calls
Trigger: Click – Phone Calls

There’s no additional set up in GTM needed to get this tag working.

Mailto Links

Similar to phone calls, this is just another way that users can reach you. 10 years ago, I wouldn’t have put as much importance on tracking these because not all users have their email client configured on their computer, but now it’s important to have with the growth of mobile devices.

Tag: GA – Mailto Links
Trigger: Click – Mailto Links

PDF Downloads

Not every website is going to have PDF downloads, but it’s important to have just in case one ever gets added to your website.

Tag: GA – PDF Downloads
Trigger: Click – PDF Downloads

Note: You may have other file type downloads on your website. If that’s the case, then I encourage you to change this tag to a generic file download tag and include the file extensions in your trigger.

YouTube Tracking

This is a very helpful tag to track all of your YouTube videos on a website. For this example, I’ve pulled the method used by Luna Metrics on YouTube Tracking In Google Analytics & Google Tag Manager.

Tags: GA – YouTube Events; HTML – YouTube Events
Trigger: CE – YouTube Video
User-Defined Variables: DLV – YouTube Video Action; DLV – YouTube Video URL

Pretty much what’s happening here is the HTML – YouTube Events loads JavaScript that listens for events sent to the data layer. Those events trigger the GA – YouTube Events tag to fire send the appropriate information through the event action and label.

Note: Don’t forget to set non-interaction event to true on GA – YouTube Events if you autoplay your videos.

Here are a couple other articles for tracking videos with Brightcove and Vimeo.

Scroll Tracking

I’ll be honest that I don’t use this one a whole lot, but it can be useful for those of you that want to understand how much users are scrolling down your page. It can also come in handy if you ever get in a dreaded ‘below the fold’ argument with someone. 😉

Tags: HTML – Scroll Tracking; GA – Scroll Tracking
Trigger: CE – Scroll Tracking
User-Defined Variables: DLV – Scroll Distance

I used this helpful article from Luna Metrics on scroll tracking in GTM for tracking this behavior.

404 Page Tracking

Again, this might be one of the largest oversights I see when taking on existing sites. Proper 404 tracking is highly useful because no one likes broken links! Using this method will also allow you to potentially set up alerts when someone visits a 404 page, so you can act on it right away.

Tag: GA – 404 Pages
Trigger: PV – 404 Page View
User-Defined Variable: JSVAR – Page Title

In this method, I’m using a unique term in the page title to identify a 404 page. So if your 404 page template title has the word ‘sorry’, then you’ll want to add that word in this condition.

If your 404 page template does not have a unique identifier, then you’ll want to refer to my post on tracking 404 pages with Google Tag Manager. This post will also help you better understand the thinking behind this set up.

Getting started

I have created an export of the container that you can download here. I hope this saves you a little time next time you start tagging a new website using GTM.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.