An introduction to Tag Management Systems

In this part we will introduce you to Tag Management Systems also named by their acronym TMS.

Let's start by a big disclaimer here:


In this part we will only introduce one TMS solution which is Matomo Tag Manager as this is the only Free software TMS solution out there. Having a Free software is really important/interesting as it ensures you the control of your data collection. As you can imagine when you are using a proprietary TMS hosted somewhere that you don't have the control on, it means that everything which is executed on it, is collected by the solution server.

Before introducing TMS we will briefly talk about CMS (Content Management Systems) in order to use this as a comparison example.

So, many years ago, organizations used to create their website from scratch, they were using basic text editors in order to build their HTML and CSS files. It was long and fastidious as they needed to re-create everything from scratch everytime that a new page was created and needed to play a lot with copy/paste with a high margin of errors. In order to change that out, some guys created what we call CMS (for Content Management System), those software are here in order to easily manage contents (text, pictures, videos...) without having to code at all. It provides them a simple GUI (Graphical User Interface) like this they don't have to care about the technical stuff.

Nowadays the most famous CMS is named WordPress which is a Free software released under GPLv2 license. There are many others CMS out there, all of them providing different features, plugins, templates...

Ok, now you understand why people adopted CMS rather than continuing building website from scratch. So we can now introduce TMS.

In the past, analysts were used to insert tags (so tracking codes) directly within the source code of their website/app. The issue was that some of those codes were buggy, sometimes they did not have the expertise so they needed to ask developers to insert the code for them... and it was taking ages. As a result some guys thought about creating software which could provide a GUI (Graphical User Interface... I think you are going to learn this term by heart) in order to manage all those tracking codes. Those software are named TMS (for Tag Management System) and now you know the full story. So nothing scary TMS are just tools you will use in order to make your data collection easier, you just need to make yourself comfortable with the UI, by chance, so as CMS there are not many things you need to know about.

Main reasons why people should adopt the use of TMS for analytics projects:

  • For a better management (your analytics work is organized so as the one of your team.
  • Easier to manage all your tags in one place.
  • To increase security (security is a big word but it will be easier for your security team to analyze one space rather than checking multiple)
  • To decrease the loading time of your website (inserting directly the code in your pages lead sometimes to unecessary data collection)
  • To let the marketing team deploy their tags according to their needs (you have to consider here that if your marketing team is always dependent from your IT team they won't have the possibility to learn and it won't allow them to feel confident on the long term).
  • The container is hiding a little bit more the source code than the tracking code itself, so it is a bit more complicated for your competitors to spy on you.

Before going further into TMS,  let's review the vocabulary, as a result, you won't feel lost afterwards:

Container: all the tracking codes you will deploy through the TMS will be included within what we call a container. As its name stands for it, it contains... and it contains what? Tracking code... which are also named tag, so the name Tag Management System. Think containers as the one you can see on ships. Those containers contains stuff... so as containers in TMS, nothing complicated here. A container include: tags, triggers and variables that we are going to see below.

Data layer: a data layer is placeholder in order for you to be able to use the data within it for your tag management system.

Tag: tags are tracking codes. It can be JavaScript tracking code, HTML tracking code also named pixels and you can also include classic HTML and/or CSS code. This last part is handy as sometimes you need to insert information banners. For the comparison with CMS, Tags are the equivalent of posts/pages you would publish in CMS.

Trigger: a trigger is the condition which will execute the tag/tracking code. Sometimes, there is a bit of confusion for newbies because they don't understand why they need them. In fact without TMS they were inserting the tracking code on all the pages and the data was collected fine. Well the reason is that when they were inserting it on all pages, it correspond to a condition which is that the code is present on all pages. To make it simple, triggers are nothing more than a set of rules you are defining in order to launch the execution of the tag. If you need a comparison with CMS, in WordPress for example, you have the possibility to decide when the blog post will be publish by selecting a date/time in the future, same thing with trigger, it is just that the possibilities to make the tag live are numerous.

Variables: variables are values which can be dynamic. You will use them in order to define very powerful tracking codes. For example, let's imagine that you have a slideshow on your home page and that you would like to track which image in this slideshow is the most clicked. Without variables you would have to create one tag for each image. With variables you will define one tag and the value within it will be automatically filled in like magic. To make it simple variables are great and will level up your digital analytics skills.

Version: a version is associated to a container. As many changes can be done to a container you will be pleased to see that all your modifications can be recorded within a version. This is very handy as some containers can be very complex, by creating several versions you will be able to access old containers where your work was working fine.

Publish: by default your container won't be live, this is a security. In fact you have to understand that publishing tracking codes on a website is not without consequences. In fact tracking codes are slowing down websites and can even break them in some configurations. That's the reason why you need to be aware of what you are doing before publishing.

Preview/Debug mode: this mode allow you to publish your container but only on your browser. As a result you can see how your container is working without affecting your internet users.

And that's it in terms of vocabulary you know now everything you will find within a TMS.

Ok but how does a TMS work?

A TMS works thanks to the container that you will include on all the pages on which you would like to collect data. This container is nothing more than a JavaScript code, to demistify it, here is how it looks like for Matomo Tag Manager:

<!-- Matomo Tag Manager -->
<script type="text/javascript">
var _mtm = _mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='http://localhost/matomo/piwik/js/container_W8MZ7kMl.js'; s.parentNode.insertBefore(g,s);
<!-- End Matomo Tag Manager -->

So you need to copy and paste this code on all your pages and then once it is done, you are good to go. It means that everything you will insert through the GUI will be deploy according to your wish.

We are used to saying that copy/pasting this container on your pages will be the only technical action you will have to perform when using a TMS. This is not 100% true all the time, it really depends of the type of website/project you will have to deal with. For example sometimes the data you need is not located on the page, so you need to find a way to call an external service to get this data and sometimes it does require programming language which cannot be executed by the TMS. Typically that would be the case with server-side programming language such as PHP. Imagine for example that you would like to track an e-commerce order, as some information are not included within the confirmation order page, such as the SKU of of the product, you will need to insert some additionnal code on your page in order to query your database. In order for your TMS to be able to access to those data we are using what we call a data layer, this extra code is here in order to store the data and make it available for your TMS.

Last modified: Sunday, 8 September 2019, 6:43 PM