Google Tag Manager Tutorial: A Complete Step-By-Step Beginner’s Guide
Share This Post
Digital marketing relishes data and no matter what type of website you have, it is essential to understand how people are interacting with it.
We all know that Google offers a range of tools to help people manage their websites. One of those tools is called Google Tag Manager (GTM) which allows you to deploy marketing tags to your website without ever having to modify code. Essentially, you no longer need to rely on developers to carry out all functions on your website.
Although the popular Google Analytics can provide you with a lot of the important insights, Google Tag Manager, used in conjunction, takes that to the next level and allows much more data collection.
Google Tag Manager makes it easier for the client or the person in charge of the search engine optimization (SEO) and marketing campaigns to add new tools without having to get in touch with developers to implement some code for them.
In this guide, we will look at what Google Tag Manager is, how it works and why you need to use it.
What Are Tags?
Manually coding tags for every activity you want to track can be incredibly time consuming and tedious. In some companies, only the IT departments have the right knowledge to complete the development. This might mean having to raise a support ticket every time you want to track a new tag. For example, if you add a new button to your website, you’ll have to get the IT team to tag it for tracking within Google Analytics.
With Google Tag Manager, all of this is made a lot simpler. I will show you how later in this article.
What is Google Tag Manager?
Google Tag Manager is a free tool to ease the tagging burden. Marketing teams can simply embed a code into their sites pages once and each time you want to create a tag, Google Tag Manager codes and embeds it for you. That is not to say that it completely removes the need for any technical knowledge, which will come clear as we go through this guide, but it certainly can remove a lot of the reliance on IT Supports teams over time.
Setting up Google Tag Manager
If you are part of a marketing team, you might already have a Google Analytics or Gmail account. Google Tag Manager needs its own separate account outside of that.
This was taken in October 2019. If yours looks a bit different, they change their site quite often so don’t panic!
You will then be presented with the screen below where you can start setting up a new Google Tag Manager account.
Once you click Create Account, you will be asked to start entering some details.
As you can see from the screenshot, the information you need to add is quite basic, asking for your Company Name, Country, website URL and where you will be using the tags. If you are setting up tags on different devices e.g. an App and a website, you will need to have multiple accounts. We won’t cover that in this guide but ensure you look into it if it’s going to be a requirement.
For the second part, you might need to engage a little bit of developer help. This will only be during the setup process, anything after that can be handled without technical knowledge. After you have created your account, you will be presented with some code to apply to the head and body tags of your website pages. It will look something like the below.
You don’t necessarily have to set the code up straight away, but I would advise you for the sake of tick it off the list. It will always be available within the Google Tag Manager dashboard if you decide not to do so.
Next up, you will want to start setting up your website tags for everything that needs tracking. It would be quite easy to jump in and start setting up tags for every possible behavior on your website. However, one reason why businesses struggle with Google Tag Manager is because they fail to standardize their tags.
Google recommends that you follow a simple naming convention for your tags:
As an example, this might look like:
Google Analytics – Button Click – About Us Page
You will appreciate these naming conventions when trying to look at reporting in Google Analytics as they will be listed in very self-explanatory way.
The best place to start is to create a spreadsheet with all the tags you might need and put them all in a consistent format. This is good practice from a governance and auditing point of view.
To start creating a tag, click the Add New Tag button in your dashboard which is circled below.
In the top right corner you can edit the name of your tag. Make sure it is something you recognize, ours is just an example below.
If you click in the Tag Configuration box, you will be asked to choose a Tag Type from a long list of options.
Select the purpose of your tag which will often be Google Analytics which we will use here for demonstration purposes. You will then be taken to the next step of configuration.
For Google Analytics, you will need to enter the tracking code found in your Google Analytics account and then choose the type of tracking. In this case, I have chosen to track Page Views but it could be an Event or Transaction. This will depend on the type of behavior you are monitoring.
If you select Universal Analytics in your configuration, the options to track a specific event might be:
Set your Google Analytics Tracking ID
Choose “Event” for the track type
Set your Event Category, Action, Label and Value as desired*
*It is worth exploring all the different options. There are too many to go through in this guide, but you can set up tags and tracking for just about any event.
Once you have configured your tag, you will setup triggers against it. The trigger dictates how you want the event recorded.
For example, it could be every time somebody visits the page.
The standard trigger to use is the All Pages trigger. This tells your tag to fire on every page of your website. Let’s say you have some YouTube videos on your website. A tag could be set to trigger every time a user interacts with one of those videos on your website pages. It could even be based on viewing progress to give you some measures of website engagement.
When you are happy with your configuration, click the blue Save button in the top right-hand corner of the screen. To ensure your tag works, make sure you click the blue Submit button on the next screen once you have saved.
After you click on submit, you are taken to the Submission Configuration page. If you are ready to publish the tag straight to your website, click “Publish and Create Version” followed by the “Publish” button. The Save, Submit and Publish buttons are always in the top right corner of the screen.
Before publishing your tag, it is vital that you check and debug your work. You can see how tags work by checking them in Preview Mode. You will see the grey Preview button within your Google Tag Manager workspace.
Preview mode allows you to navigate to your site and see how the tags operate while you browse. It is a very quick method of seeing if the triggers have been built correctly and the tags are firing at the right times.
Google Tag Manager will give you a summary of the tags that fired on your site. If any have not fired, double check that you performed the right actions to make them do so. If you still don’t get any activity, go back and double check the tag configuration.
The real-time reporting section of Google Analytics will actually show you the triggers firing even when you are only in preview mode.
The final part of your tag setup will ask you to enter Container Description. Add the details as required to explain what your tag is designed to do.
Congratulations, you have created your first Google Tag Manager tag!
You can set up a tag and make it trigger but within Google Tag Manager, you also need to understand variables.
Variables are designed to make the values you are tracking dynamic and vital if you want to start scaling up your tag management. You can track static variables when you use your Google Analytics Tracking ID but a good example of a dynamic variable comes with something like videos.
For example, you would have a setup like below to ensure user behavior is effectively monitored. You will see a static variable in the category section but then dynamic actions and labels against that.
This type of variable can start getting quite complex and it is best to start small. In the example below, we will show you how to use a variable against a trigger for a defined action.
Tracking a Button – putting it all together
One of the most common uses for Google Tag Manager is tracking button clicks. I am going to show an example of how you would set up the tag, trigger and variable to complete the task.
Find the button you want to track
First, navigate to the button you want to track on your website. This can be any button regardless of what it does. It just needs to be clickable.
View the source code of the page you are on.
If using Google Chrome, you can right click and go to “Inspect.” The terminology might vary on other browsers. You will now see the source code of the page that you are on. In here, find the button that you want to track in Google Tag Manager and note down its label. It could be something like “form-submit-button.” Ask a web developer if you are unsure
Enable the variable in Google Tag Manager
Within Google Tag Manager you need to enable the built-in variable. Select Variables and then Configure Built-In variables within your Google Tag Manager dashboard.
If the button is contained within a form, you need to scroll down and enable Form Classes.
If your button is not in a Form, you need to enable the appropriate variable for your circumstances.
Create the tag
We now create the tag as per the guide at the start of this article. This will be setup to send data to Google Analytics every time the button is clicked. As I said earlier, it is important to have a naming convention for tags. You might consider naming this one Button Click – PAGE NAME for example.
For the tag type in this instance, select Universal Analytics.
You will want to setup with the following criteria:
Track Type: Event
Label: Newsletter Sign-Up
Change the label depending on what your button is designed to do.
Create the trigger
The trigger will tell the tag when to fire. In this case, I only want the tag to fire when the button has been clicked. For the tag, select Triggering and then click the blue plus sign in the corner.
The trigger can be called Button Click – Newsletter Sign up.
Click tag configuration and then select “All Elements.”
We can now use the variable that we set up earlier as we only want the trigger to work on some clicks. In the configuration you will enter similar to the below, amending the ID’s to your own. In the example below, it assumes the button is called newsletter-form-button-label,
Preview and debug the Container to make sure your tag is firing as expected. In Google Analytics, view the Real-Time dashboard and ensure that the button is showing as having some hits. The dashboard should update within seconds. If you don’t see any data, check that the variables and triggers have all been setup correctly.
If everything is working as it should be, you can publish the Container
That is how you would set up a simple button click tracking within Google Tag Manager. It might take some getting used to but with some practice, you will start setting up triggers in no time.
If you are moving an existing website to Google Tag Manager, you probably have existing code that needs to be migrated or removed. If you don’t do this, there is a risk of having both the Tag Manager and code trigger running at the same time, causing data to duplicate.
For a successful migration, there are several steps that should be taken to audit your website.
Categorize and log all of your existing website tags. You should note exactly where each of them is and what action they complete.
Start recreating those tags in Google Tag Manager one by one
Each new tag you set up should be tested and previewed before you move on to the next one
Remove current code as you set up the new Google Tag Manager tags
Publish your Google Tag Manager container with all the new tags when everything above has been completed.
It is important to migrate your tags in the most efficient way possible to avoid any loss of data. If you have lots to migrate, there is a trigger suppression technique that you can use to avoid gaps in tracking. I won’t go into detail of that technique in this post, but I recommend reviewing it if you have 100’s of tags setup already.
The Benefits of Google Tag Manager
With Google Tag Manager you can totally customize the data you are sending to Google Analytics. For example, you can start monitoring which buttons get clicked on your website pages or how many people are downloading a particular PDF. It is true that you can also code this without Google Tag Manager but why rely on a developer when you can do everything simply yourself?
For example, say that you want to see PDF download volumes in your Google Analytics dashboard. In Google Tag Manager, you can create a category name, action and label, setting the appropriate attributes. Say we call this “PDF Download.” In the Event Behaviors section of Google Analytics, you will see the “PDF Download” appearing in the summary with metrics against it.
You can track all kinds of items that wouldn’t be possible without Google Tag Manager including form abandonment, shopping cart abandonment, scroll tracking, video tracking and pretty much any activity or behavior users might undertake on your website.
Google Tag Manager keeps all your code in one place without it being scattered across multiple website pages. Traditionally you would need individual scripting in HTML wherever required but now you don’t have to. Centralization is a big reason to move to Google Tag Manager.
As a side, if your IT department or developer is not having to spend time adding tags, they have more time to focus on bigger, more complex tasks. Businesses are able to better utilize the skills of their employees. Second, if you are not relying on humans to manually type out tags, it reduces the risk of coding errors.
Best of all, when it comes to documenting and keeping historical annotations, Google Tag Manager makes this all possible. It is easy to build an audit trail of every single change for the Container type setup.
Another advantage of Google Tag Manager is that it isn’t just limited to standard websites but can be applied against AMP sites and mobile apps as well. One of the advantages here is that you can update your mobile app without having to re-release it, given the code is all within Google Tag Manager and not hard coded. There are differences in the setup for these channels but the concept of tagging remains the same.
Cons of Google Tag Manager
Although there are several benefits to Google Tag Manager, it is important to recognize some of the challenges that comes with it.
While in the long-run, Google Tag Manager helps you reduce the reliance on developers, you will have seen throughout this guide that there is still a need for some technical knowledge. For example, you will still have to add the container code to each page of your site. Although the task isn’t necessarily difficult, it stills sits outside the scope of a typical marketing resource.
Some users have reported that tags do slow down site speed if you start firing them off synchronously. If you add too many tags to your site, the danger is that when a page loads, they all try to trigger at the same time, impacting the page load speed. The longer a site takes to load, the more likely people are going to leave it without completing an action. Within Google Tag Manager, you can set up tag sequencing to schedule the order they should be firing in.
We have used a few terms constantly throughout this guide. Here is a reminder of the key terminology you should be familiar with when using the platform.
As soon as you start setting up Google Tag Manager, you will need to be creating some containers. The container holds all the tags for your site. When you create your first container, Google Tag Manager gives you some code that needs to be added to the pages of your website. Some of the CMS type sites like WordPress have plugins that help you with this but for custom built sites, you may need a web developer to assist.
Once a container has been added to the site, anything you publish within Google Tag Manager is automatically applied.
Every tag that you build for your containers needs to serve a specific purpose. For example, you could be trying to track when somebody downloads a file or submits a form. The events associated with a tag are known as the triggers. A tag must have one assigned to it otherwise it has no purpose and just takes up space in Google Tag Manager.
A trigger will have an event and a filter. There are a huge number of event types to pick from and once you choose one, you can set up a filter for it. The filters have variables, operators and values. The operator will tell the tag whether an event needs to be a certain value. If the value is met, a trigger is fired. It doesn’t have to be a number and could be a keyword or the name of a URL.
As an example, if you have a single page website, you could have a trigger that fires when somebody scrolls 50%, 75% and 100% through it to see how engaged they are. The trigger can be set up to operate on all pages, one page or some pages.
A tag depends on having a trigger and a trigger depends on having a variable. The variable is where the trigger will find the value that it needs to evaluate, determining whether or not it should be fired. You could also use a variable in tags to pass on to a data layer when users interact with the website. For example, a tag can be set to fire when a user adds a certain amount of a product to their shopping cart.
Users can use built-in variables or create custom ones. There are a huge number of options within Google Tag Manager and the best advice is to test them and learn with experience. If you look online, there are lots of guides to different types of variable.
Data layers are one of the most complex and technical parts of Google Tag Manager. I won’t go into a large amount of detail in this guide as it could become overwhelming until you have gained a bit more experience in the platform.
That is a beginner’s guide to get you started with Google Tag Manager. You should have enough information here to help you get started with the tool, but it will take some time before you are an expert. It is important to plan your tags properly rather than trying to run before you can walk with Tag Manager.
Here are some of the most common mistakes I see when using Google Tag Manager:
Not previewing containers before publishing. Even if you are very confident that you’ve set up your triggers correctly, they can fail for various reasons and checking failures is fundamental to success.
Publishing too much will only clog up your Google Tag Manager account. If you have planned the data you want to gather, only publish once you have completed the necessary tracking steps.
If you only have a small website with little content, you might think there isn’t much value in deploying Google Tag Manager. However, smaller sites could be the best use cases as they are the easiest to integrate with. Ultimately, any tool that can easily allow you to optimize your business performance without technical knowledge is worth the investment.