Google Tag Manager: what, why and how

If you run a website, you probably have one or more services like Google Analytics, Google Ads or Hotjar tracking the visitors to get some information about them and how they use your website to help you get more and better traffic and improve the user experience.

If you do this, you are probably tired of having to add, edit and manage so many different codes and the problems that they may cause. Especially if you track conversions, you are used to adding a single tracking code to every page or action where you want to track them, sometimes being really hard even for advanced programmers to figure out the best way on how to implement it.

GTM: all tracking codes in a single place

This is exactly what Google Tag Manager (GTM) is for: managing all tracking codes from different services in just on one place, having to insert in your website only one tracking code and only once.

The concept is genial: you add just once a JavaScript snippet to your website and forget about it. Every time you want to add a new tracking service or edit an existing one, you don’t have to add any more code to your website nor change the existing one, but you can manage all this directly under the GTM control panel. The code you added to your site the first time takes care of transmitting all information that the other services may need without having to insert the tracking codes of those single services.

How does Google Tag Manager work?

Without getting deep into details, it works like this: you activate certain tracking services or tracking codes via GTM like Google Analytics or Ads Conversions. Those single tracking services or codes are called Tags. Each Tag is only triggered after some action defined by you happens on your website. Those definitions are called Triggers. Those triggers transmit some information to the tracking code that they are activating. This information is called “Variable”. For instance, a variable may be the price of a product being seen, buyed or requested in your website by the visitor.

Almost anything on your website can be used as a trigger, and you can pass as variable whatever info you may need.

Example: Let’s say you want to use the Google Analytics and a Conversion tracking for Google Ads everytime a visitor submits any form.

This means you would have two tags, one for Analytics and one for this conversion. Analytics should be triggered everytime a user sees a page, so the trigger would be “all page views”. The conversion should be triggered only when a visitor submits a form, so the trigger is the submit of any form on your website. The variables that can be transmitted to both Analytics and the conversion must be defined before under the GTM Panel Control.

Tag Trigger Variable
Google Anayltics All Pages *
Google Ads Conversion Submit any form Name of the form

This is especially interesting for online shops or websites having good defined products, categories and sections since they can pass all this information via variables to the different tracking services. For instance, in addition to the table above, an online-shop for clothes could pass some extra information to Google Analytics or any other service about the product that the user is interacting with:

Tag Trigger Variable
Google Anayltics Visit any product page Product price
Google Analytics Visit any product page Product size
Google Anayltics Visit any product page Product color
Google Analytics Visit any product page Product category

This information would be available at the reports of Google Analytics or any other service used for it, and so the online shop could better understand their audience and clients and help to target them better.

Of course, this is just a very simplistic explanation and we didn’t even talk about the Data Layer. There are a lot of more details to know, but explaining all this would be over the scope of this article. Do not hesitate to contact me if you need help setting up your Google Tag Manager account or implementing it on your website.

Which services can you track with GTM?

One of the biggest misconceptions about Google Tag Manager is that you can only use it with Google Services. Of course, you can use it with all Google services like Ads, Analytics, Floodlight, Optimize, Surveys, etc.., but not only they are available; you have a lot of other third-party services directly available under the GTM control panel ready to be activated with just a few klicks:

Please, not that this list may change in the future. Do not forget that you first need to open an account on those services to use them.

Do you want to implement GTM on your site?

If you are using WordPress, you could use my plugin Easy Cookie Law. It will help you show the required cookie notice and put the tracking code in your site.

If you are using any other software than WordPress or need some help and guidance, get in contact with me.