From the course: Learning Google Tag Manager

Understanding the GTM hierarchy - Google Tag Manager Tutorial

From the course: Learning Google Tag Manager

Start my 1-month free trial

Understanding the GTM hierarchy

- [Instructor] At the heart of the Google Tag Manager is something called the container. This is what's going to contain all of your scripts and tags that the system will inject into the page. To understand why this is important let's look at the older way of running scripts on a page. This way each webpage has the underlying HTML and the scripts that are going to render the page into what we see on the screen inside the browser. Now this may include analytics tracking scripts, Google Ads conversion scripts, retargeting scripts, marketing automation scripts, video tracking, special transaction scripts that are only going to go on certain pages once a transaction has occurred, and so on. In this manually coded model each script has to be written in ahead of time on which page it is going to go and where it will be fired. Those scripts are coded up with the rest of the HTML on the page, and they sometimes interact with the various buttons, forms, links, and so on the page itself. Some of those can change dynamically, so managing all of this is increasingly difficult and in some cases it's just impossible. Now, the more modern tag manager model instead puts a single snippet of JavaScript on the page that is identical across all of the pages. And this JavaScript acts as the conduit, or the container, that's going to house all of these other scripts and tags that the system decides to inject into the page at exactly the right time. Now which scripts and tags get loaded, that's not decided back when the code is published to the site, but rather in real time when users load the page on the browser. So this is a much cleaner structure that also gives you enormous flexibility in terms of what to load and under what circumstances and conditions you're going to fire those various tags. Now, while this container itself is the main workhorse, there's more we need to understand. The container that sits in these pages holds three types of entities; tags, triggers, and variables. Tags are the code snippets that collect and manipulate the data. The most common example of this is your web analytics tags, but there are literally thousands of these tags that can perform similar functions. Some are already prebuilt as templates and they're ready to use inside of Tag Manager, but you can always create your own custom HTML and image tags as well. Now there are an ever increasing number of these turnkey template tags being added as GTM grows, and it's really a good idea to use these templates as they're much less complex to use in a snippet and because the vendor provides them directly. So we're going to show you how to do all of that in this course. Triggers are the rules and conditions that we will specify to tell GTM when to fire each tag. For example, you may have a trigger that looks through your thank you page URL and then fires the various conversion tracking tags with the right shopping cart totals. Variables are bits of information that can be stored and accessed by your tags and triggers. Some are automated and populated by GTMs, such as the value of the URL, and some can be populated by the user such as your specific account numbers or even dynamic values such as the amount of money spent in a transaction. So GTM is a tool that exists within the Google marketing stack and it leverages Google single sign on authentication. So once you register with Google, using either a Gmail address or any other Google account, perhaps your work account, you will then be able to access Google Tag Manager by simply visiting the site, which we're going to walk you through in a moment. You can also have multiple containers as we see here, most commonly one container per website or domain. These containers are all accessible and viewed in one GTM account, and that one GTM account is going to be accessed via your main Google login, also known as a Google account. And you see that here in the top right by main email address. So in this example, our single Google Tag Manager account, the CardinalPath Primary as we've called it, is accessed via our Google login, so that's Corey@CardinalPath.com, and it holds two containers. The first is for the www.CardinalPath domain, and the second is for CoreyKoberg.com. This difference between a Google account, which is your login, and the Tag Manager account is very similar to those of you who are used to having a Google login and a separate, or even maybe multiple, Google Analytics accounts, or Google Ads accounts. Same idea, you log into Google once, and then you have all of these different services and accounts you can utilize. Okay, let's take a quick look at the interface and see how all this fits together. What we want to do here is go to tagmanager.google.com. And what we'll see here are the various accounts that my Google login already has access to. For example, we have a CardinalPath test account. I have an account for my personal site, and another one down at the bottom I've created just for the LinkedIn Learning demos. Inside of this account here for LinkedIn, we have three containers, but mostly we use the Hansel & Petal one. You can see the container ID over here. Now, if I click into the container itself, we're going to see a dashboard here and on the left we can see the tags, the triggers and the variables for this container. Now that we have a lay of the land, in the next few videos we're going to back up and create our first set of these from scratch and put all of this to work.

Contents