October 28, 2020
Google Tag Manager Tutorial + Video & Free E-Book for Beginners
Updated: October 28th, 2020. Google Tag Manager is an amazing tool. Need to add a particular tracking pixel to a website? Not a problem! Want to track submissions of a newly created form? Consider it done. All thanks to GTM.
Instead of waiting (for days) for a busy developer to add those tracking codes you could do this by yourself (well, in many cases). Even though you will not replace developers 100% (and, in fact, you never should), with Google Tag Manager you (and your team) will become much agiler implementing new marketing campaigns and/or web analytics tracking.
But where should you start? Tag Manager looks like a tank that requires some very specific knowledge and your regular driver’s license won’t help much here. Just like any other tool, GTM has its own learning curve. That’s why I decided to create this Google Tag Manager tutorial. It’s the first step towards becoming more independent + having more control over your analytics/marketing tracking codes.
Ready? Let’s start. If you have some questions about GTM, feel free to post a comment.
Table of Contents
+ Show table of contents +
- The Pre-Tag-Management world
- What is Google Tag Manager?
- Google Tag Manager vs Google Analytics
- Top benefits to start using Google Tag Manager
- How does Google Tag Manager work?
- Your first setup
- So what’s next?
- If you need to become a GTM professional as fast as you can
- What should you learn next?
- Frequently asked questions
If you prefer to learn from the video content, I have recorded a Google Tag Manager tutorial and published it on YouTube. To get started, click on the video player below or click this link.
Before we continue: The Pre-Tag-Management World
It can be Hotjar, Google Analytics, or some other tool, but they all ask you to add their code (tag) to your site. When a visitor lands on your website, that tracking code is also loaded, therefore, a visitor is tracked.
Adding that one tag to a site isn’t big of a deal. You just ask a developer and he/she will do that (sometimes on the same day, sometimes over the course of several days, but still reasonable because this has to be done only once).
But here’s the catch. Out of the box, GA offers plenty of metrics. But to make really good and thoughtful decisions, you need to track much more: interactions (e.g. clicks, form submissions), sales, etc.
This means that more tracking codes must be added to a website. And usually, this is not just a “one-time project”. You need to constantly add new tracking codes and modify/remove the current ones.
That’s where the developer (and the IT department) becomes a bottle-neck. Since he/she is working on his own tasks/projects, marketing/analytics tasks often are a B priority, therefore you and your team have to wait. And wait a bit more. And more.
That’s where the GTM saves the day and this Google Tag Manager tutorial will show you how.
What is Google Tag Manager?
Google Tag Manager is a tag management solution that acts as a middleman between a website and marketing/analytics tools. All you need to do is to add your tracking codes to GTM and then configure rules when they should be activated(on page load, click, form submission, etc.).
Imagine that Tag Manager is a Toolbox, where you keep all your tools: a ruler (Google Analytics), a hammer (Google Ads), etc.
Google Tag Manager also lets you test your tracking tags to make sure they are triggered when you load a page or click a particular button. Another great benefit: you can change your tags and the way they work without actually changing the source code of your website. Instead, you just edit tags in the GTM user interface and publish changes with a click of a button.
Google Tag Manager vs Google Analytics
Many beginners confuse Google Analytics with Tag Manager by asking which one should they use now. The answer is actually both. These two tools do not replace each other, they work together. Google Analytics is a tool that collects visitor data and displays it in various reports, while Google Tag Manager is responsible for activating tools like GA.
If you still feel confused about the relationship between Google Analytics and GTM, read this guide: GA vs GTM – what’s the difference?
As I have mentioned before, Google Analytics is not the only tag compatible with Google Tag Manager. Other examples include:
- Google Ads Conversion Tag and Remarketing Tag.
- Facebook Pixel code
- Pinterest tag
Top benefits of Google Tag Manager
There are many benefits of using Google Tag Manager but I’d like to point out, in my opinion, the most important ones.
REASON #1. Fast Deployment of Tracking Codes
Instead of having to wait days or weeks for a developer to implement your tracking codes, in many cases, you will be able to do it by yourself (without actually editing the website’s code).
REASON #2. All Tags Are Controlled in a Single Place, your GTM account
I’ve seen many cases when due to a human error some codes were missed, therefore this caused inaccuracy in data collection.
Thanks to Tag Manager, this process is made easier: all tags are controlled in one place.
REASON #3. Built-in and 3rd Party Testing Tools
Troubleshooting and correcting tag errors is simplified via Tag Manager’s Preview and Debug mode that shows which tags are fired on a page and which are not. It also includes information about triggers that fire tags and data contained within tracking tags.
Why is it important? With Google Tag Manager debugging solutions, you’re making sure that your tags work before you publish them to the live site. Also, let’s not forget other useful browser extensions such as Tag Assistant, Data Layer Inspector, etc. I’ve listed a lot more of them in a blog post called Top Google Tag Manager Extensions for Chrome.
Still not convinced? Continue reading this Google Tag Manager tutorial and I’ll show you the goldmine.
REASON #4. Fairly simple event tracking
Once you enable a certain trigger in Tag Manager, it will start automatically listening to particular website interactions. There is still some setup required, but it is relatively straightforward to do. You can use those interactions to fire tracking codes, e.g. GA Event Tag.
Basic events that you can track (by default) in Google Tag Manager are based on:
But wait, there’s more! Thanks to the growing community of GTM users and enthusiasts, the number of auto-event tracking functions constantly increases. You can also add custom features that record things such as new comments, video players and much more.
Just keep in mind, that more complex events still might require a developer’s input. Although Google Tag Manager gives you some superpowers, it doesn’t make you almighty.
REASON #5. Ready-made Tag templates
Google Tag Manager comes with a number of important built-in tags for classic and Universal Analytics, Google Ads conversions, remarketing, and more. This allows a marketer with little or no coding knowledge to customize tags, without implementing a complicated code or asking for a developer’s help.
If you still have some doubts about whether you should start using Google Tag Manager, here are some additional posts tailored to you:
How Does Google Tag Manager Work?
For very beginners, there are three concepts to understand: tags, triggers, and variables.
A tag is a piece of code that must be fired on a website under certain circumstances. It can be a tracking code, some piece of code that changes the text or a particular website element, or even code that changes the color of the browser’s address bar, you name it. When you create a tag, you basically instruct Tag Manager to “do this”, “do that”, “track page views of this visitor”, “track this click and send to Google Analytics”, etc.
A trigger is a condition when a tag must fire. Should a tag fire on all page views? Or maybe on certain clicks? How about successful form submissions? All of these examples are triggers. When a particular condition (or a set of conditions) is met, a trigger is activated and all the tags (linked to it) are dispatched.
A variable is the final member of this trinity. Variables are little helpers that can be used in tags, triggers, or even in other variables. A variable can:
- hold a single piece of data (like page URL, website domain, product ID, ta ext of a link, etc.)
- hold a set of data/settings (GA settings variable contains multiple settings related to GA, like Tracking ID, Display Advertising settings, etc.)
- be a complex function (but this one is too advanced for beginners, therefore, let’s skip it, at least for now), etc.
The best way to understand the relationship among tags, triggers, and variables in Google Tag Manager is to take a look at an example (see the image below).
- Google Ads Conversion Tag is a tag. With it, you instruct the Google Tag Manager to do what? Track a conversion.
- When must this tag be fired? The answer is On a Thank You Page (a.k.a. order confirmation page). This condition is our trigger.
- Now, we need to use some additional information in order to send more precise data to Google Ads and to make our trigger actually work.
- With Google Ads conversion tag we can send Order Total which is a variable. Whenever a successful purchase is complete, the G Ads tag will fetch the value of the variable Order Total and send it over to Google’s servers. Variables are things that make Google Tag Manager tracking dynamic.
- In the trigger, we need to precisely instruct Google Tag Manager when to fire. Saying on a Thank You page is comprehensible for a human. But in Tag Manager, we need to be more specific. What is a Thank You page? The answer: it’s the page of which Page URL contains “/purchase-successful/” (P.S. this is just an example). In this case, the Page URL is a variable and we have instructed GTM to constantly check the Page URL when the page loads. If a variable (URL) contains “/purchase-successful/”, the trigger will be activated.
So as you can see, variables can be used in both Tags and Triggers. You can also use them in other variables but you’ll learn that in the future (not in this guide).
Create a Google Tag Manager Account
To get started, first let’s create a GTM account. Go to Google Tag Manager’s official website and click the main call-to-action in order to create a new GTM account.
Just like with any other Google’s product, you will use the same Google account for Tag Manager. So if you’re already on Gmail (Google Ads, Google Analytics, etc.) you will be automatically logged in to Google Tag Manager. If not, create a Google account first (I will not show that procedure, so you’re on your own here 🙂 ).
Once you log in, you’ll be asked to create a new GTM account and a new container.
In the Account Name field, enter the name of the business (e.g. your company’s business or your client’s business). If you are an agency, it is a better practice to ask your client to create a GTM account and then share the access with you.
In the Container Setup section enter the name of your website (it can be a domain (e.g. example.com) or just a name (e.g. My website). In this e-book we will cover Web tracking, thus choose Web as the target platform.
Google Tag Manager account works the same as the GA account, usually, it’s for a company/business/client, while a container is usually for a website or application. A single container can contain many tags, triggers, and variables.
However, if there are several websites that belong to a single business and their structure is very similar (plus, their tracking implementation is similar), feel free to use one container on multiple websites.
How to Install Google Tag Manager?
After you create a container, you’ll get two codes that must be added to a website. Hand over these two snippets to a developer and ask him/her to carefully follow the instructions (the first code should be added somewhere in the <head> of a website, while the second should be added right after the opening <body> tag).
Thanks to this code (implemented on a page), all the tags will be fired when they are configured to do so.
If you want to learn more about the proper installation, read this guide on how to install Google Tag Manager on a website.
If you’re using a popular content management system, like WordPress, chances are that there is a ready-made GTM plugin that eases the installation process + adds some additional benefits.
For example, in WordPress, there is an awesome plugin GTM4WP. Not only will it help you easily install Google Tag Manager, but also you can get some additional data from it, like page author, page tags, etc. Later, this data can be turned into GTM variables and used in tags and triggers.
Feeling tired? If yes, bookmark this Google Tag Manager tutorial for beginners and come back any time later when you’re ready to dive into the world of tag management.
IMPORTANT: Publish your empty container
Once you create the new container in Google Tag Manager, you have to publish it (otherwise a thing called Preview mode will not work). To publish the container, click the Submit button in the top right corner and then click the Publish button.
Once you do this, you should see that the current version of your container is 1.
How to check if Google Tag Manager is working?
After the GTM code was implemented on a page, you need to make sure whether it was actually properly installed. There are several options you can choose from (all of them are explained in detail here):
- Right-click anywhere on your website’s background -> choose View page source and find that code (by looking for gtm.js)
- Enable preview and debug mode and see whether it appears on the screen. Click the Preview button in the top right corner of GTM interface, then go to the website (refresh it) and check whether a GTM preview mode works.
The tips above are the main ones you could try right now. I have a longer (and more detailed) list here (in case you need it).
Creating Your First Tag in Google Tag Manager
Important: even though Google is actively pushing people to start using Google Analytics 4, I highly recommend to keep using Universal Analytics as your main analytics tool. Google Analytics 4 is on the right track but it is still lacking some basic features. That is why this tutorial is still explaining how to install Universal Google Analytics (a.k.a. Version 3).
But if you still want to get started with Google Analytics 4, take a look at this tutorial.
Usually, the first tag that marketers/web analysts install with Google Tag Manager is the Google Analytics Pageview tag. This is equivalent to the procedure where GA asks you to add their tracking code snippet to all pages of a website.
If you are new to Google Analytics, then you will need to sign up here and create a new account + property. When you create a property, you should choose the “Advanced settings” and then toggle the “Create a Universal Analytics Property” option.
After you do it, you will see that very same tracking code that I’ve recently displayed. When you get to see that code snippet, let’s add it to a website with help of Google Tag Manager.
In Google Tag Manager, go to Tags and click New.
A window will slide in from the right. It consists of two parts, Tag Configuration and Triggering. Click anywhere on Tag Configuration block and choose Google Analytics – Universal Analytics tag type.
Leave Page view as a Track Type and then in GA Settings Variable drop-down choose New Variable. You’re about to create your first variable.
GA Settings Variable is a great time-saver. What you will learn in the future is that in each Google Analytics tag you’ll need to separately set various settings, like GA tracking ID (UA-XXXXXX-XX), cross-domain settings, custom dimensions, etc.
The more GA tags you have, the more inconvenience it will cause. Imagine a situation when you suddenly have to do a single change in 40 tags, that’s 40 manual changes! Thanks to GA Settings Variable, you can assign it to multiple tags and when you need to change some configuration, you need to do this only once (and all GA tags that will be using it will inherit the settings).
Anyway, back to our GA Settings Variable. For starters, we need to insert the tracking ID of our Google Analytics account (because Tag Manager must know to which GA account should it send the data).
Go to your GA account > Admin (of the Universal Analytics property) > Tracking Info (on a Property level) > Tracking Code and then copy the Tracking ID. Not the entire code, but just the ID.
Go back to the Google Tag Manager interface and paste the ID in a GA Settings Variable.
Save the variable and you’ll be brought back to the editing mode of the Google Analytics Tag.
Tag configuration part is complete, now let’s set the trigger. In the Triggering section, click anywhere on that white block and choose the trigger, All Pages.
This condition means that the Google Analytics Page View tag will fire on all pages where Google Tag Manager container code is installed.
Save the tag
That’s it! Save the tag. This is all you need to do with basic GA implementation. If someone asks you to install the standard tracking with GA, that is all you need to do, create a Page View tag. It is the equivalent of adding that GA tracking code (which is provided in the Admin section of GA property) to the website’s source code.
Testing with Preview Mode
Before we publish these changes and start tracking all the visitors, first we need to make sure that everything is configured properly. That’s where the GTM Preview Mode becomes very useful (in fact, this is one of my favorite features in Google Tag Manager).
Google Tag Manager Preview mode allows you to browse a site on which your GTM container code is implemented.
To enable Google Tag Manager Debug mode, click the Preview button in the top right corner of your GTM interface (near Submit button).
If you ever stumble upon older GTM tutorials (published before the October 16th, 2020), they will tell you that an orange banner must appear in the GTM interface (when the preview mode is enabled). That is no longer true. From October 16th, 2020, the orange banner is gone.
Once you click the Preview button, a new browser tab will open with tagassistant.google.com. If it does not, read this guide.
A popup there will ask you to enter the URL which you want to test and debug. It might be the address of a homepage or it might be a specific page’s URL and then press Start.
A new browser tab (or window) should appear where you will see the URL that you entered in the previous popup. At the bottom of that page/tab, you must see the following badge:
And if you go back to the tagassistant.google.com tab, you must see this success message.
Click Continue in that popup and you’ll see the Preview and Debug page (also known as the Debugger). If you want to learn more about the preview mode, watch this video.
Once you enable the Preview mode, click Container Loaded event on its left side. This is the earliest moment when your tag might fire.
Every time you set a tag to fire on All Pages, it actually means All Contained Loaded events. After you click on the Container Loaded, you should see your GA Pageview tag in the “Tags Fired” section.
Great! Before we start celebrating your first tag, we need to check whether that pageview data actually reached Google Analytics (because the fact that tag fired does not mean that data was properly sent. For example, a tag may be incorrectly configured and send page views to the wrong GA account).
The best way to check if the data was actually sent to GA is Real-time (RT) reports. In Google Analytics, go to Real-time > Overview. Navigate through various pages of your website and see if all those page views are displayed in RT reports.
If the GA tag is firing but no interactions are displayed in RT reports, read this troubleshooting guide.
Another useful tool that you should definitely try (if you haven’t used it yet) is Google Tag Assistant. It is a Chrome extension that reports on various Google tracking scripts and checks if they are properly configured (like Google Ads, GA, Google Optimize, etc.).
Also, Google Tag Assistant will improve the experience of GTM Preview mode which is why I recommend installing it.
Publishing the Google Tag Manager Container
Once you’ve finished configuring and testing tags/triggers/variables in the container, publish it (otherwise, those changes won’t go live and your visitors/users will not be tracked). Every time a container is published, a new container version of it is created. This is very useful because in the case of “oops….”, you will be able to quickly restore to one of the previous versions.
In the top right corner of the Google Tag Manager interface, click blue the SUBMIT button.
Choose to Publish and Create Version. Although Version Name and Version Description fields are not required, it is highly recommended to fill them out. Once your container version history grows to 10, 20, or more versions, those names, and descriptions will become very useful (when you’ll try to find out when a certain change was implemented).
After that, once you hit the PUBLISH button, your changes will go live and you will start tracking page views of visitors.
A quick offtopic. Do you enjoy this Google Tag Manager tutorial and found it useful? If yes, consider subscribing to my newsletter and further advance with GTM.
So what’s next? What should you do now?
My suggestion: start using Google Tag Manager on all new projects. The size does not matter, it might be a simple website or it might be a larger e-commerce business. Even if you don’t plan to track events and just need the basic page view tracking, still use GTM. Google Tag Manager first, then GA Page View tag. Because you never know, maybe one day you’ll suddenly need to track something that X project and you’ll be able to do that in no time (because Tag Manager will be already implemented there).
But what about those projects/websites that already have some Google Analytics or other tracking tools implemented (not via Google Tag Manager)?
There are a couple of options here:
- The most recommended: migrate all the hardcoded tracking scripts from the website’s source code to Google Tag Manager. This process is not easy and will require both your and the developer’s input but in the long run, it will definitely pay off. Just think about how long were digital marketing campaigns delayed because the developer was busy with other projects/tasks. With GTM you could implement tracking much faster and you/your team would become much agiler.
- You can implement new tags with Google Tag Manager while old tags are still hardcoded (P.S. in this contest, “hardcoded” means that tracking scripts are added directly to the web site’s source code). Just make sure that you’re not tracking the same interactions with both hardcoded script and Google Tag Manager (otherwise your data in reports will be duplicated).
If you need to become a GTM professional as fast as possible
This Google Tag Manager tutorial is just a first step in learning how to master GTM. There are MANY more things that a beginner must learn. You have two options here:
- Take the long path and try to figure the stuff on your own, read/watch countless GTM tutorials in random order, and try to connect the puzzle pieces on your own.
- Take a proven and shortest way + to get mentored. That’s where my Google Tag Manager Masterclass for Beginners is irreplaceable. In it, I will show you the correct (and shortest) path that a beginner should take in order to solve the most common web tracking challenges. And if you are even more serious about learning GTM, take a look at my intermediate/advanced course as well.
What should you learn next after you read this Google Tag Manager tutorial?
The list of Google Tag Manager topics that you can learn is definitely a long one but if you’re just starting, here are my suggestions:
- Take this free Google Tag Manager Fundamentals course (in addition to what you’ve learned in this Google Tag Manager tutorial, you’ll also find out how to track link clicks, implement custom scripts, etc.)
- Data Layer
- Form tracking
- Video tracking
- Dive even deeper into click tracking
- Virtual page view tracking (on a Single Page Website)
- If you want to learn how to track events with Google Analytics 4 and Google Tag Manager, take a look at this tutorial.
The list goes on and on (I’m just scratching the surface here). In fact, if Google Tag Manager was a narrow topic, I wouldn’t have published more than 200 GTM blog posts. But it’s totally possible to achieve, you’ll just need a lot of time, determination, and will to learn.
Frequently Asked Questions about Google Tag Manager
I bet that there are still a lot of questions in your head right now. That’s totally normal! Here are the most common ones. If you have more questions (that were not answered in this guide), feel free to leave a comment below.
#1. Does Google Tag Manager work only with Google Products? No. Google Tag Manager plays well with a lot of platforms/tools. It offers a wide range of predefined tag templates (like Google Analytics, HotJar, Twitter Universal Tag, etc.) and, additionally, you can add custom codes with help of a Custom HTML tag.
#2. Is Google Tag Manager free? GTM has both Free and Premium plan. A free plan is more than enough for small and medium businesses. Large enterprises can benefit from a paid Google Tag Manager 360 option. You can compare both pricing plans here.
#3. What if my content management system does not allow to place Google Tag Manager code in the <head>? Don’t worry, this is not the end of the world. Actually, GTM <script> code can be placed anywhere on the website. The higher you put it in the website’s source code, the sooner it will load, therefore your web tracking will be more precise. But if your CMS allows placing all codes only at in the <body> tag, that is still fine. The most important thing is that you must not place the <noscript> code in the <head> of a website. All other variations are allowed (e.g. both codes can be placed right after the opening <body> tag or both codes before the closing </body> tag).
#5. Do I still need developers after I start using Google Tag Manager? It depends on what your goals are. Even though a lot of new opportunities open to digital marketers after they start using GTM, sometimes a developer’s help is still necessary. Such interactions as video player actions, scroll tracking, element’s appearance on the screen, etc. will be pretty easy for you to track (as you get more experienced with GTM). But if you need some server-side data (which is not accessible by Google Tag Manager), for example, user ID, user’s pricing plan, you’ll need to cooperate with the developer.
#6. Where can I get help regarding Google Tag Manager?
- Google Tag Manager Community on Facebook (recommended and the most active)
- Google Tag Manager Community on Reddit
- Official community forum
- Stack Overflow
Pssst… There are many more GTM questions I’ve answered (I just did not want to make this Google Tag Manager tutorial too long). But if you’re interested, feel free to check my Google Tag Manager FAQ.
Google Tag Manager Tutorial: Final words
GTM is one of my all-time favorite tools that has saved me a lot of time and helped me become agiler in digital marketing/web analytics. In this Google Tag Manager tutorial for beginners, you’ve learned that GTM is like a middleman between a website/app and 3rd party tools (e.g. Google Analytics, Google Ads, Facebook pixel).
Back in the old days, all tracking codes (tags) were controlled by developers who had to add them to the website’s source code. This workflow caused several problems. To name a few:
- Developers were too busy, therefore, marketers/web analysts had to wait days or even weeks to have their tracking scripts implemented.
- Multiple tracking codes meant that they were scattered across different places of the website which meant more difficulties in the maintenance of the code.
Thanks to Google Tag Manager, adding, editing, and removing tracking scripts have become much easier. In a single interface, marketers can control codes (read: tracking tags) of various tools, like GA, FB Pixel, etc. To make things much easier, most popular tools can be controlled with the help of tag templates which do not require coding knowledge.
Also in this Google Tag Manager tutorial, I’ve explained what tags, trigger, and variables are in GTM, what is their role, and how are they connected with each other.
Tags are various pieces of code (or templates) that are activated under certain circumstances. Triggers are those conditions that activate tags. And variables are little helpers that can hold data (or some useful settings/functions) and can be inserted in tags, triggers, and even other variables.
Prefer video content instead? Take a look at this tutorial on Youtube.