What is Google Tag Manager and how does it work
Google Tag Manager is a tool that helps you track and record different web activities through code installed on your website referred to as tags. GTM (Google Tag Manager) gives you an easy way to manage and update the tags you run on your website.
GTM allows you to directly manage the tags on your site through something referred to as a container. A container is an account reference and requires a unique piece of code to be installed for each container.
You may use a single container across your entire site or you may choose to have containers broken out, depending on what you’re tracking and how you need to manage the deployment.
Within the container in GTM, you install tracking codes using 2 primary methods; tags, and triggers. A tag is the code that’s fired, the trigger is the condition that must be met for the tag to fire.
For example, using GTM to fire your Google Analytics code snippet; The tag is the code snippet from Google Analytics that needs to fire in order to record GA data, and the trigger for this code is “all pages” (because we want it to fire on “all pages”).
Why would you use GTM
There are many reasons to use GTM, in most cases if you work in a marketing role that requires web tracking and performance measurement you should be using GTM. Not everyone feels comfortable with advanced tools such as GTM, but with the guidance from this article and a little trial and error, you'll be up and running in no time.
Common reasons to use GTM;
- You don’t wait for a web development team to make code updates for you, you can launch and make updates through the container in GTM that has already been placed on the website.
- You have many more options for tracking - without GTM you need to place inline tracking or page based tracking for many goals, but with GTM you can set many more "listening events" to be your trigger
- Deeper listening - you can record all sorts of insights using GTM, things like Youtube video views, percentage watched, how far someone scrolled down a page… All sorts of insightful data can be recorded.
How to install or gain access to GTM
To use GTM you need to gain access to an existing Google Tag Manager account already installed on a website, or create a new account and install it. If you run into an instance where you can see the website has a Google Tag Manager account and it is already loading on the site in reference you should try as best you can to gain access to the existing account.
There are a few points for access; at the account level, and at the container level. If you’re only working in a single container, then access on this level is enough. If you need to help create new containers, or anything outside of the single container, then account level will be needed.
Just like with most accounts, go into the admin area of GTM (or instruct the client to do this), and under the “User Management” section, for either the account and/or the container, add a new user with the “+” icon. The appropriate permissions are set when a new user is invited into the account, and they can be updated if access needs change down the road.
Creating a new GTM account
In the case that an account doesn’t exist you’ll need to create a new one. In this scenario, it’s best to consider which account should create the new account, since this will be the account that maintains ownership, and manages granting permissions once created.
- Visit https://tagmanager.google.com to create an account
- Make sure to login to the proper Google account that you want to own this GTM account; you can check your login by clicking the picture or personal icon in the top right of the screen.
- Click the option to “Create Account”
- Give the account a name (use the company name)
- Give your first/default container a name (use the domain this will be placed on)
- Select where the container will be used (most likely “web” for your purposes)
- Click create
- Read and accept the terms of service agreement
- Once finished with the last step, you’ll be directed to the page with implementation instructions - there are 2 different pieces of code required - pass these to the web development resource that will be loading these code snippets into the website for you. Be sure to include all of the details:
- “Paste this code as high in the <head> of the page as possible”
- “Additionally, paste this code immediately after the opening <body> tag”
- While the implementation is being finalized, you can go back and grant access to any users that need to work in the container or account.
Installing tags and triggers
With GTM access in place you can now load and launch your first tag. The best place to start is loading Google Analytics through GTM, other common tags might be your Facebook Pixel, Twitter Ads, Hotjar, etc.
Inside the GTM “Workspace” (this is the reference to your container and carries an account number looking something like GTM-ABCD12E) you’ll see an option down the left side for Tags. Click the tags option and begin to create your first tag following these steps:
- First give your tag a name. It’s good practice to use a common naming convention for easy reference in your account, let’s say this is your Google Analytics snippet, you could call it “Google Analytics -- All Pages”
- Next, you need to load your tag; the tag is the code that is required to be placed on the site. For many tags GTM offers pre-built connections, Google Analytics is one of those. If you’re installing the Facebook Pixel code you’ll need to use a custom HTML tag.
- Once you select the tag type that you need and have loaded the proper code or tag details, then you’ll need to select a trigger. The default trigger for your account will be “All Pages”, but you can set up customized triggers for all sorts of functions which we’ll cover a bit more in the next section.
- After you define the trigger for your tag, you’ll need to give it a name, this could be “All Page Views”
- Before launching you should preview and test your tags. Select "Preview" in your GTM account then head to the site where the container is published. A bar will load at the bottom of the website showing which tags are loading. If you have conditional tags - things that fire on an action - perform the action to ensure the tag fires. If the tag does not fire, select the tag and view the variables to find out what you need to update on the tag.
- Now you’re ready to launch. To launch your code changes you’ll click submit in the upper right - assuming you don’t have a review protocol to follow.
- Once you click “Submit” you’ll be asked for a version name, my default version name is the date, formatted yearmonthday.timeofday - 20190505.1134
- I use this formatting to keep a clean chronological order to changes, and use the time of day addition as many changes could be made in the same day.
- Once published you should do one more step to validate and QA that everything is working properly. There are many ways to do this, and depending on what you’re launching may require different methods - you already QA'd the tag using preview prior to publishing the updates, so now you can lean on Analytics real time to see how updates are recording.
Recording and capturing events through GTM
Finally, we’re about to learn how to track better, more insightful actions through GTM that can improve your reporting! Now that you have access to deploying tags and triggers, it’s time to define what you need to track that’s not being recorded or best reported on now. Some examples of things not recorded through a standard Google Analytics snippet;
- Newsletter subscriptions
- Form inquiries
- Links that exit your site to social communities
- Downloading PDFs
- Liking a piece of content or sharing it through available buttons
- Phone calls
These are a few of the most common items that you’re missing from your reporting that can now be tracked in no time with GTM. We’ll go through a single example to show how these actions are recorded.
Triggers in GTM require an element referred to as variables. Variables are the various listening identifiers that can be used as “triggers”. GTM provides a handful of standard variables out of the box at install, but you can change, modify, and even create custom variables to track just about anything.
In our example we’ll use form submissions to walk through a setup.
- In GTM let’s begin with a tag, what do we want to happen when the form is submitted?
- Select “create a new tag” to begin
- Choose Google Analytics as our tag type
- Since we want to record a form submission, choose “Event” from the dropdown for Track Type.
- Then give the category, action, and label you’d like recorded inside Google Analytics.
- Category = form
- Action = submission
- Label = page or form name (for example: “pdf download form”)
- In the label it's common to insert an element from the form. In this case we could choose to put the form name in the label so we can track all of our forms more granularly.
- To support the event, if you wish to track this as a conversion, be sure to create an event goal in Google Analytics that will record when your fields match (We have a guide on this if you need help on setting up goals properly. One note, you can make the category and action required but leave out the label, this makes it less intensive for the number of goals required in analytics but still makes the label data available via event insights if needed.
- The next step is to choose whether this is a non-interaction hit, a form is an interaction hit so leave this as false.
- Select the Google Analytics settings variables you wish to use here and save it.
Now it’s time to choose and create the trigger.
- When the “choose a trigger” page opens, select the blue “+” icon to add a new trigger.
- Click the pencil icon next to choose or create a new trigger.
- From the options, select “Form Submission” from the User Engagement options.
- You can choose to leave this as “All Forms” or you can select “Some Forms”.
- Now we’ll need to define which forms we want to fire this event.
- There are many ways to identify your forms for tracking. If you direct form completions to a landing page like /thank-you then you can use that as a condition. Or if the forms all use the same form ID, then you can track those specific forms when they're submitted. An easy way to find your condition is to use preview mode, click on the button for the form you wish to track. When you see the recorded link click in the tracking feed you can click and see all of the tracking conditions you can use to identify this form. If you wish to track this form only, and not others around the site, make sure to check other forms so you don't use the same variables.
That’s all it takes for this example, but this is barely scratching the surface of what you can use to track actions and events using GTM. From here, you can save, submit, and QA your tags to make sure they’re working as they were intended.
Improved reporting with conversions
Now that you’re using GTM to listen for and trigger events, it’s time to remove noisy and conflicting conversions. It’s all too common that companies are recording conversions for everything from multiple pageviews, SMART goals, and so on. To improve your reporting, it’s helpful to measure only actual “Conversions” in your reports. To get to this point, you need to weed out all the unnecessary conversions that are recording and diluting your view of actual conversions.
When setting up conversions, make sure that what you’re recording is reflective of a true inquiry or action of importance. Let’s consider an example of a marketing program aimed at generating leads, a conversion in this example could be;
- Joining the newsletter
- Downloading PDFs or ebooks
- Scheduling a demo
- Calling sales
- Asking for more information via forms
The above actions all represent a key value to creating opportunities and leads, the goal is to make sure your conversions are valuable and support tracking of your end goal.
Cleaning and organizing codes in GTM
As a final note, you’ll want to make sure you’re not running multiple tags across the site as it can cause issues with tracking and accuracy. If you have Google Analytics installed directly on your website prior to the GTM install, you’ll want to remove it now once you have Google Analytics firing through your GTM container. The same goes for any other tags placed through GTM that were placed directly in the website before.
GTM can be a huge asset to your tracking and performance reporting if used and leveraged properly. GTM has plenty of online resources to teach you how to accomplish just about any tracking requirement, and if you need help or input on a tracking project feel free to reach out.
Thanks so much for reading!