18 min read

The essential beginner's guide to Google Tag Manager (GTM)

Designed for the busy professional. Learn the fundamentals and use GTM with confidence. Covers everything you need. No more, no less.
The essential beginner's guide to Google Tag Manager (GTM)
Photo by Angèle Kamp / Unsplash

Google Tag Manager (GTM) is an incredibly powerful tool. It is perhaps the most widely used platform to deploy and manage all kinds of marketing and analytics tags on websites. There are other tag management platforms in the market but I have not come across a good enough reason to use any of them so far. The free version of GTM is very robust and should handle the needs of most marketers. For enterprise customers, there is the option to upgrade to the paid tier.

In a hurry? Jump straight to these sections.

Who this guide is for

I wrote this guide for beginners. I originally intended this as a training guide for my own team and an educational resource for my clients. If you are just getting started in your career, or simply looking to level up your digital skills, you should find everything you need in this guide to effectively use Google Tag Manager. I start from the very basics and walk you through more advanced topics. For all the edge cases, of which there are several, I will reference some of the best resources I've found on the internet for you to continue your journey.

I did not write this with intermediate and advanced users in mind. However, upon reflection, I think there might be something of value for you as well. This is a reference you can pass along to your colleagues or friends who might be looking to level up.

I regularly test my content for readability and understandability with folks just getting started. If you have a strong opinion about something here please DM me on LinkedIn and tell me what could be improved. It will help make the experience better for all. 

What is Google tag manager?

Google tag manager or GTM is a tag management platform that helps you deploy and manage marketing or analytics tags on your website. Think of GTM as a home for all your tags. Tags, also known as pixels, are simply little pieces of code that are required to measure what happens on your site. Every platform (Google Analytics, Facebook, Google Ads etc.) has its own tag and as a marketer, the number of tags you are required to deploy and manage can quickly add up.

There used to be a time when getting tags on websites used to be much harder. You needed to hard-code tags onto the site which made things, well, very messy. It used to take time, caused errors in implementation, and most importantly, required the assistance of a developer to get things done.

GTM acts like the home for all your website tags.

GTM attempts to solve these pain points by acting like a conduit between your website and all the tracking tags you need. You configure your tags in GTM, not directly on your website. In nearly 95% of instances, you should be able to deploy and manage tags without requiring changes to your website's code which will save you and your team a lot of time. In my opinion, it is probably one of the most useful things you can learn to level up your knowledge of digital.

Basic concepts

With any new platform, there is new terminology to learn. And GTM is no exception. In my opinion, there are three basic concepts that you need to understand really well. And those are tags, triggers, and variables.

  • Tags are what you need to collect data
  • Triggers are the instructions that tags require to work
  • Variables are the basic building blocks in GTM that help you create things like triggers (like little LEGO pieces)

Let's spend some time and absolutely nail these before moving forward.


A tag or pixel (used interchangeably) is simply a piece of code that you place on a website to measure or track something. There is nothing inherently mysterious about tags. They are just small bits of code used to collect data. Below is an example of a Facebook pixel, which once configured and deployed, sends data from your website to the Facebook platform.

An example of a Facebook pixel.

The structure of every Facebook pixel you encounter will look the same. The only change you will notice is with the pixel id which will be unique for each pixel. You can use the id to identify if you have the correct pixel installed on your website.

GTM comes with several built-in templates for deploying tags. This means, that more often than not, you wouldn't even need to directly copy and paste snippets of code. I recommend using these templates whenever possible because they are a lot simpler to use and lead to fewer errors during implementation.


A trigger is simply the condition or set of rules you define to fire a tag. Think of them like instructions. Without triggers, tags will do absolutely nothing. Every tag that you deploy and manage needs to have a trigger associated with it.

Triggers work only when they meet certain conditions.

So how do you know exactly what triggers you need to use? The short answer is, that it depends on what you are trying to achieve. Here are some of the most common types of triggers I use, and have seen used in Google Tag Manager.

  • Fire on all pages on a site
  • Fire only when a URL is loaded, such as a thank you page that loads after someone completes a form
  • Fire when a specific button is clicked, such as a navigation link in the header
Types of triggers in GTM and their use cases.

GTM comes with several built-in trigger types which you can use to configure your triggers. There's a very good chance that in 9 out of 10 situations, you will use a trigger built on some combination of a Page View or a Click. I have very rarely used other types of triggers but that's not to say you won't need to use them.

Instead of memorizing all the different ways to set up triggers, I find it useful to have some basic tenets to reference as this allows me to configure any type of trigger I need.

Tenets I reference when creating triggers:

  • Is the trigger specific? Am I certain that it will work only under the circumstances I need?
  • Is the trigger comprehensive? Am I certain that it will work under all the circumstances I need?
  • Is there a way to make this trigger any simpler? Simpler triggers tend to be more reliable and easier to understand.

We'll review more examples of triggers when we walk through how to create and deploy tags.


A variable is a slightly more abstract concept to wrap your head around. I like to think of them as tiny LEGO pieces that can take on different values. They are the smallest building blocks we have access to within Google Tag Manager.

Let's go back to our earlier example from the section on triggers.

Did you notice that we used a variable when we defined one of the triggers? The trigger we associated with the conversion tag was configured using a variable called the Page URL variable. The trigger works by checking the value of the Page URL variable every time a different page is loaded on the website.

When someone is on the homepage, the URL does not contain the value thank-you, and the trigger does nothing. It did not meet the condition we defined. When someone fills in a form and reaches the thank you page, the page URL contains the value thank-you. The trigger now meets the condition we defined and will work.

An example of the Page URL variable used to define a trigger.

The Page URL variable is one of several built-in variables in GTM we have access to. Let's review a few more examples to make sure we understand this concept really well.

Variables and triggers

Variables are commonly used to define triggers and you start noticing them when your triggers become more and more specific. Let's say you have a 1300 phone number on your website and you want to track how many people call you. We'd need a trigger that fires only when someone clicks on the phone number. We can set this up using another type of variable called Click URL.

An example of the Click URL used to define a trigger.

Variables and tags

Variables can also be used with tags. A very common use case in marketing is to fire a tag every time someone completes a purchase on your website. To set this up, we would first need a trigger that instructs the tag to fire when someone reaches that page or completes the purchase action. We know we can use the Page URL variable to define this type of trigger.

Suppose we want to pass some additional information to the tag, such as the names of the items that were purchased, the quantity, and the purchase value. Now you can imagine that for every purchase, the items, quantity and purchase values can be different. So how do we pass the values of each purchase when they are dynamic and can change? This is where variables can help us once again.

We store the values associated with the item names, quantity and purchase value in variables. And pass these values to the tag when it fires. Under the hood, this is how the e-commerce reports in Google Analytics are populated with values. We will examine how this works in more detail when we cover the section on the data layer.

Now let's get familiar with some of the other important concepts in Google Tag Manager. These are containers, versions, workspaces and folders.


The GTM container or container tag is the home for all your other tags. It is the tag that is deployed on all the pages of your website. Depending on your website, you should be able to do this yourself with the website builder (e.g. Wix or Squarespace), plugins (e.g. WordPress) or with the assistance of a developer if the site is custom built.

An easy way to check if GTM is deployed on your website is to right-click and view the page source of the webpage. A tab will open up with the page's source code. Search (Ctrl-F) for GTM and if you find it on the page, there's a good chance the container has been deployed on the website. Note, that this is not foolproof but can help you quickly check if GTM is on a page.

The GTM - ID will help you confirm if the right container is deployed.

One of the most common questions you will find yourself asking is how many containers should I create?

There is no perfect answer to this but I use the following framework and it's served me well so far:

  • One GTM container per website or domain. It helps keep things neat and tidy.
  • If there are subdomains, such as an e-commerce store or blog, use the same container as the main website.
  • If you have a global brand with multiple websites (multiple domains), create one container per website (domain).
  • If you have a global brand with a single website spanning dozens or even hundreds of locations, you may need to look at a solution like GTM 360 (paid) to help you link additional tag manager containers to the main container. Whilst a setup like this can be managed with the free version, you will find that as your needs become more complex, you will start hitting the limits of the free tier and it's worth thinking about upgrading to the paid tier.


The concept of a version is somewhat intuitive to understand. A version is like a snapshot of a GTM container in time. We have the live version which is the deployed version of the container that is live on your website, the latest version you are working on and is your draft, and older versions from previously published containers.

Versions are one of the features of GTM that make it really powerful. You can test your tags in your draft container before you publish them to the live version. And should you encounter any issues, you can always roll back to a previous version of your container.


Many websites have multi-tiered environments in their development workflow. It is common to see changes first made in a development version, before being tested in a staging version and finally being deployed to the live version of the website.

Environments is a feature in Google Tag Manager that helps us publish the changes to a container in different versions of a website. This gives us some additional peace of mind by making sure we are satisfied with the changes in a staging environment before being published to the production version of a website.

This short video walks you through the basics of this feature. Super handy!


Workspace, as the name suggests is a feature in Google Tag Manager to concurrently manage multiple sets of changes to a GTM container. When you add tags in GTM, you are making changes to a workspace. Multiple workspaces allow teams to work concurrently on the container without inadvertently publishing someone else's unfinished changes. GTM (free version) comes with a default workspace, and you can create 2 more workspaces for your team. This tends to be more than enough for many of the clients I work with. The enterprise version of GTM (paid) allows you to create unlimited workspaces and is useful for bigger teams with more complex needs.


I have almost never encountered an instance of GTM that did not suffer from some form of tag bloat. The most common offenders are marketing tags that were trialled for a hot minute and swiftly forgotten. These tags could lie around for years adding clutter to your workspace. More importantly, they can slow down the speed of your website so it is best to keep your GTM workspace tidy.

I would highly recommend keeping your workspace tidy by organising your tags into folders. Your workflow will determine the folder structure but the option I most commonly use is to

  • Group folders by vendor name (e.g. Google Analytics, Google Ads, Facebook and so on)

I don't tend to place variables and triggers into folders as these can be shared by different tags.


You will need a Gmail account or a Google account to access Google Tag Manager. In many cases, you may need to create a google account with your work email because your company wants you to use that instead of your personal Gmail account.

An account can be linked to multiple GTM containers. Marketing teams that manage several websites tend to have all these containers linked to the same Google account. The same would be true for someone who works at an agency managing several advertisers.


You have 2 levels of control to manage access and permissions for a GTM container, account permissions and container permissions.

Account permissions are permissions set at the account level and can be set as Admin or User.

  • People with Admin access to a GTM container can fine-tune their container-level permissions by themselves.
  • People with User level access will need an Admin to make those changes for them.

At a container level, you can fine-tune your permission level by adjusting the container level permissions.

The various container level permissions in GTM.

GTM has the following container-level permissions:

  • No access: The user will not see the container listed in the account.
  • Read: The user will see the container listed and may browse the tags, triggers, and variables in the container, but will not have the ability to make any changes.
  • Edit: The user has the right to create workspaces and make edits but not create versions or publish.
  • Approve: The user has the right to create versions, workspaces, and make edits but not publish.
  • Publish: The user has full rights to create versions, workspaces, make edits, and publish.
I would recommend giving the person responsible for configuring and/or deploying tags Admin access to the GTM container with Publish level container permissions.

With this level of access, they'd be able to create versions, workspaces and make edits, and publish tags. A responsible external agency should know what they are doing and are unlikely going to do anything to break your website. When the tagging job is finished, you can always downgrade their permissions.

How to deploy GTM on a website?

Here's a quick video that shows you how to deploy GTM on a website. This is only for demonstration purposes but my goal was to illustrate how simple it can be. In most instances, you should be able to send the GTM code snippet to your developer and request them to install it on all pages of the website.

How to create, test and deploy a tag in GTM

Before I jump into GTM and create a tag, I like to have some details ready so that the tag creation process is smooth. The details we need depend on the type of tag, but all tags will need a trigger associated with them. And so at a bare minimum, I try and describe the trigger I will use in advance.

I highly recommend documenting everything you do in Google Sheets or some other spreadsheet software that others can access. This will save you and your team a lot of time down the track when trying to figure out why something was done the way it was.

Deploying tags with GTM involves 4 basic steps:

  1. Create the tag (preferably using a tag template)
  2. Associate with a trigger (you may need to create a trigger)
  3. Test it with the preview and debug mode
  4. Once tested, publish it

I've captured this basic process in the video below. I use the GA4 (Google Analytics 4) tag in this example.

Data layer

I wanted to squeeze one advanced concept into this guide because it is so common in the world of GTM that it would be remiss of me to keep them out of reach of beginners. Sooner or later, you will work with the (mysterious) data layer and my goal is to make it less abstract so that you can approach them with confidence.

Sometimes, such as with an e-commerce transaction, you need data from your website's server such as product SKU or purchase value to pass through to an analytics tag. You need some place to store this information so that GTM can access it. The data layer is the place where we can temporarily store the data we need for our tags and triggers to access.

You don't see the data layer in the presentation layer of a website which is why it might be initially hard to wrap your head around.

The data layer is a virtual layer on your website and acts like a temporary store for data which GTM can access. 

When you deploy GTM to your website, it automatically creates a data layer. In fact, you can spot the data layer in the GTM container tag's code snippet.

<!-- Google Tag Manager -->
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->
An example code snippet of a GTM container tag

It is only when you need to populate the data layer with some additional information that you require the assistance of a developer. Let's review the example of an e-commerce purchase event to bring this to life. This may appear a little intimidating at first, but I encourage you to stick with it and not give up. Code is just like writing instructions or a recipe. It becomes easier the more time you spend with it.

How to use the data layer for Ecommerce reporting

Google Analytics (now GA4) requires that you pass information to it in a very specific format for it to be able to ingest this data and present it correctly in reports.

Let's compile what we know about the GA4 tag

  • Tag type: GA4 event tag
  • Event Name: purchase
  • Trigger Type: Custom Event
  • This trigger fires on All Custom Events

Additional data that the tag requires (this is what is being accessed from the data layer):

  • Items
  • Transaction ID
  • Value
  • Currency

You can ask your developer to push these values into the data layer so that they can be temporarily stored and accessed by Google Analytics. The code snippet below is a sample data layer object for the purchase event. Note that the values will be dynamically populated each time a purchase happens.

dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
  event: "purchase",
  ecommerce: {
      transaction_id: "T_12345",
      affiliation: "Google Merchandise Store",
      value: 25.42,
      tax: 4.90,
      shipping: 5.99,
      currency: "USD",
      coupon: "SUMMER_SALE",
      items: [
        item_id: "SKU_12345",
        item_name: "Stan and Friends Tee",
        affiliation: "Google Merchandise Store",
        coupon: "SUMMER_FUN",
        currency: "USD",
        discount: 2.22,
        index: 0,
        item_brand: "Google",
        item_category: "Apparel",
        item_category2: "Adult",
        item_category3: "Shirts",
        item_category4: "Crew",
        item_category5: "Short sleeve",
        item_list_id: "related_products",
        item_list_name: "Related Products",
        item_variant: "green",
        location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
        price: 9.99,
        quantity: 1
        item_id: "SKU_12346",
        item_name: "Google Grey Women's Tee",
        affiliation: "Google Merchandise Store",
        coupon: "SUMMER_FUN",
        currency: "USD",
        discount: 3.33,
        index: 1,
        item_brand: "Google",
        item_category: "Apparel",
        item_category2: "Adult",
        item_category3: "Shirts",
        item_category4: "Crew",
        item_category5: "Short sleeve",
        item_list_id: "related_products",
        item_list_name: "Related Products",
        item_variant: "gray",
        location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
        price: 20.99,
        promotion_id: "P_12345",
        promotion_name: "Summer Sale",
        quantity: 1
A sample data layer object for the GA4 purchase event.

There's a bit going on here so let's spend some time unpacking the code.

  • It has some indentation, which implies things are nested within each other. This nesting is important and should be adhered to during implementation.
  • Much of it follows the same pattern of key & value pairs, e.g. price (key): 20.99 (value), item_brand (key): "Google" (value)
  • The values are encoded in a specific format, e.g promotion_name: "Summer Sale" is a string, quantity: 1 is an integer, value: 25.42 is a float

I've stripped down the above code snippet to a simpler form below and added comments to help translate the code. Spend some time with this and try and understand every single line.

dataLayer.push({ ecommerce: null });  // Clears the previous values
dataLayer.push({ // Pushes values in the key:value format into the data layer
  event: "purchase", // This is a purchase event
  ecommerce: { // It contains an ecommerce object with the foll. information
      transaction_id: "T_12345", // Transaction id
      value: 25.42, // Transaction Value
      currency: "USD", // Transaction Currency
      items: [ // And the list of items in the transaction
       // Each item has it's own set of attributes stored in key:value pairs
        item_id: "SKU_12345", // Item ID, in this case the SKU
        item_name: "Stan and Friends Tee", // Item name
        currency: "USD", // Item currency
        index: 0, // The index of the item in the list of items
        price: 9.99, // Price of the item
        quantity: 1 // Quantity of the item
        item_id: "SKU_12346",
        item_name: "Google Grey Women's Tee",
        currency: "USD",
        index: 1,
        price: 20.99,
        quantity: 1

When I write to developers, I try and provide as much context as possible with very specific instructions. Here are the things I would include:

  • Background and context about the project.
  • If there are multiple events in the project, I break down the instructions for the data layer implementation for each event.
  • An example of the data layer code snippet for the event.
  • A link to the documentation for the developer to reference. This will vary depending on the tag you want to implement.
It is super important that the data layer is written exactly as specified in the tag documentation. Include all the required elements and any optional elements you want to track. 

If you want to send your developers a generic reference about the data layer, this is the best developer's guide to the data layer I have found. Note, the language can be a bit obtuse so proceed with caution if you are not a dev.

Once you've shared your instructions with a developer, they may want a call to discuss the requirements with you. Don't be afraid of jumping on a call and reviewing your ask.

Sometimes they might want to test the implementation in a staging or test environment. This is absolutely fine. You can test the data layer implementation by using a chrome extension like data layer checker.

Here are my key takeaways about the data layer:

  • The data layer is automatically created when you install GTM on your site
  • It is a virtual layer so you don't see it
  • It acts like a temporary store for data you might want to access and pass to your tags
  • You will need the help of a developer to write data to the data layer
  • Ask your dev to follow the specific documentation for the tag and all will be fine
  • Don't be afraid to read code aka recipes for computers


Nice job on getting this far! I hope you are feeling more confident with GTM now.

At a very high level, this is what we covered in this guide:

  • What is GTM and why is it useful
  • What are tags, triggers and variables
  • What are containers, versions, workspaces and folders
  • Managing access and permissions in GTM
  • How to deploy GTM on a site
  • How to create, test and publish a tag
  • The mysterious data layer

If you are feeling unsure about any of this, feel free to revisit these sections. If you have a question for me, don't hesitate to DM me on LinkedIn.

My favourite GTM resources

The last section covers my favourite GTM resources. These are the places I go to and learn from.

  • Google Tag Manager Help - beginner-friendly catchall guide from Google
  • GTM official developer documentation - dev-friendly documentation from Google
  • Simo Ahava - Intermediate to advanced GTM tips and guides, very detailed but not super beginner friendly
  • Analytics Mania - More beginner friendly than Simo's guides. I go here for guidance on specific GTM concepts. Julius does a great job on YouTube as well
  • Measure School - Another resource I trust with GTM guidance. Julien also has a YouTube channel which is beginner friendly