Semji

Google Tag Manager, the complete guide

Google Tag Manager guide

Google Tag Manager is a free tool that lets you manage and deploy tags (code snippets or tracking pixels) on your website (or mobile app) without having to change the code.

Digital marketing feeds on data. Whatever kind of site you have, whether it is a large ecommerce site, a personal site, or an SME’s site, it is essential to understand how people interact with your site. Google Analytics can give you a great deal of important information, but used on its own it has its limits.

What is Google Tag Manager?

Google Tag Manager: what is it?

Google Tag Manager is a tool that will make your life simpler. With it, you no longer need to update the code on your website to say which action should fire or which page should open after an event.

Here is a very simple example of how GTM works. Information coming from a data source (your website) is shared with another data source (Google Analytics) via Google Tag Manager. It becomes very handy when you have a lot of tags to manage, because all the code is stored in one place.

How GTM works

By using Google Tag Manager together with Analytics, you can collect a lot more data. The big advantage of this tool is that the marketing team can manage the code itself.

But Google Tag Manager is not as simple as you might think. It does take some technique to understand how to configure tags, triggers, and variables.

Overview of the GTM interface

GTM interface

Google Tag Manager is made of three main parts:

• Tags: a snippet of code (usually JavaScript) added to a page, or a tracking pixel. For example: “Send a page to Google Analytics”

• The trigger: defines when and where the tags run. For example: “Every time someone visits a page”

• Variables: to receive or store the information that tags and triggers will use.

What are tags?

Google Tag Manager tag

Tags are snippets of code or tracking pixels from third-party tools. Tag Manager natively supports many Google tag and third-party tag configurations. Custom tags can still be used to implement tracking codes that are not yet supported.

Common tag examples in Google Tag Manager include:

  • Universal Google Analytics tracking code

  • AdWords remarketing code

  • AdWords conversion tracking code

  • Heatmap tracking code

  • Facebook Pixel

What are triggers?

Illustration: declencheur Google Tag Manager 700x381

Triggers are a way to fire the tag you have configured. They tell GTM when to do what you want to do, and they activate in response to events such as a form submission, a button click, or page views.

A tag must have a trigger in order to fire, and those triggers must have filters to activate the right action.

Filters contain three functions: variables, operators, and values.

The operator tells the tags whether an event should be equal to, greater than, or less than a certain value in order to trigger an action. The value, in this case, is the condition that must be met. In many cases, the value will be something like a URL or a keyword.

What are variables?

While tags depend on triggers, triggers themselves depend on variables.

Variables are additional information that GTM may need for your tag and in order to fire the event.

They hold the value a trigger must evaluate to know whether it should load or not.

Besides triggering an action, variables are also used (by tags) to collect information after an unusual event. When a user adds a certain quantity of products to their shopping cart, for example.

When you use GTM, you will work with two types of variables: built-in variables and user-defined variables. The first group the common, ready-to-use variables; the second are the ones you customize.

The most common type of variable you can use is the Google Analytics tracking ID number.

What are data layers?

GTM DataLayer

Called couches de données in French, data layers are another way for GTM to improve a site’s speed. It is a place that gathers all the information a tag needs in order to load.

Before the data layer arrived, to find a piece of information tags had to search through the page’s HTML structure, but that took time and led to problems such as broken tags when the HTML structure changed. On top of that, some information was not in a page’s code at all.

With GTM, you have the option to define data layers for your site.

How do you set up this tracking?

Creating accounts and containers

To create an account, go to Google Tag Manager. Under “Set up account,” enter the name of the company that owns the site and click “Continue.” If you use WordPress, it is recommended to close it.

Then install your container. Enter your domain name as the container name; if you have several accounts with GTM, it will be easier to find your way. Choose the type of page or application GTM will be used on, then click “Create.” If you choose iOS or Android, you will also need to specify whether you use the Firebase SDK or an existing SDK.

You can manage several GTM accounts inside a single Google Tag Manager account, but the search engine recommends creating one container per domain. You do not, however, need to create separate containers for each individual tag or for each page of your site. The container can group all the tags.

Once these two steps are done, Google Tag Manager gives you a code snippet. You then just need to copy and paste that code just after the opening <head> tag of your site; some WordPress themes and plugins make this step easier.

Creating tags

To create a tag, click “Add a new tag.” In the window that opens, you can name and configure your tag. The tag-naming convention recommended by Google is: Tag type — Detail — Location. So a Google Analytics tag that tracks form submissions on a “Contact us” page would be named “GA — Form Submission — Contact Us.”

Previewing, debugging, and publishing tags

GTM’s “Preview & Debug” mode lets you test tags before they are published. To access this function, click the “Preview” button in the upper-right corner of the GTM dashboard. You will then see an orange banner warning you that you are now in “Preview” mode.

Then open the site you are tagging. If your site is already open in another tab, refresh the page and you should see a “Debug” panel at the bottom of your screen. (Do not worry, visitors to your site will not be able to see this.)

GTM advantages and drawbacks

Advantages and limits of Google Tag Manager

Advantages

  • Free

Just like Google Analytics (link), GTM is free! Tag-management systems such as Google Tag Manager have been around for a few years now, but most of them charge a fee to use the product.

  • Reduces dependence on developers

The greatest advantage of Google Tag Manager is that it makes it easier to implement tags without help from developers, which means more savings and more productivity. If you have developers, you can assign them to other, more meaningful tasks.

That is a big advantage if, for example, you only need a tag to collect data for a short period of time.

  • Version control

Google Tag Manager lets you have versions of control. Every time you publish a change in a container, the software creates a new archived version. If you need to go back to an existing version at any time, you can do so easily. That creates a history of the changes made to the website.

  • Usable on AMP sites and mobile apps

GTM can be used with standard websites, but also with AMP sites and mobile apps! In the case of mobile apps, GTM lets you add and edit tags without having to update your app. Using Google Tag Manager is substantially the same for all 3 kinds of platforms.

  • Predefined tags

Google is well aware that most sites use a similar selection of tags. That is not limited to Google Analytics or the AdWords conversion pixel. Google Tag Manager therefore also includes tags that can be used for remarketing purposes such as:

• DoubleClick

• Marin

• ComScore

  • Features adapted to Google Analytics

Google Tag Manager makes it easier to implement Google Analytics’ more complex functions, including user-ID tracking. As a reminder, “User ID” is a feature that lets you measure real users instead of devices (PC and mobile). It gives you more precise data on your users.

  • Security

Google Tag Manager automatically analyzes every tracking script added with custom HTML tags and inspects whether it matches a malicious domain

You can also control access to GTM by setting different permission levels at the account and container level. Finally, there is also two-factor authentication, which requires both your normal password and a numeric code from Google.

  • Equipped with a central debug

Making sure your tags work before you publish them is really important. Everything you do with Google Tag Manager can be tested and debugged before it goes live. That is the revolution brought by the debugging options, the built-in error check, and version control.

You therefore have the option to see your changes in real time, without the risk that the public can see those changes.

Also take advantage of Chrome extensions such as Tag Manager Injector and Tag Assistant that make debugging easier.

Limits

  • Technical problems

Although GTM greatly reduces dependence on developers, it does not eliminate it completely. To add the container code to every page of your site, you will still need those professionals. The same is true if you want to customize tags.

Still, if you own a site and have no coding knowledge, you can already benefit from the tag templates GTM offers. Note that if you have existing tags that were added manually to your site’s source code, those should be removed to avoid duplication.

  • Tags can slow down the site

The problem with classic tracking tags is that, by loading synchronously, they slow the site down. That has a disastrous impact on conversion. Tags created in GTM, for their part, load asynchronously. You can even control the order in which your tags fire using the tag sequencing function and firing priority. Your tags can therefore fire at any time.

What was there before Google Tag Manager?

Before Google Tag Manager, the JavaScript of your website or mobile app had to be hard-coded. In other words, you had to call a developer every time you wanted to make the slightest change to your tracking code.

Now, to do those tasks, Tag Manager offers a user-friendly interface that guides you step by step through the creation of tags. Anyone with user rights can add, edit, or debug the website’s tags.

You can now take tagging into your own hands and direct your tracking as you wish, and without a developer!

Related guides