Predefined and custom GTM templates
Last year Google Tag Manager released a new feature called "Templates", which lets you build your own tag templates or pick from predefined ones.
1. April 2020
3 min
AdvancedLast year Google Tag Manager released a new feature called "Templates", which lets you build your own tag templates or pick from predefined ones.
1. April 2020
3 min
AdvancedLast year Google Tag Manager released a new feature called "Templates", which lets you build your own tag templates or pick from predefined ones. It is a marked step forward in using GTM. This set of features helps make creating tags simple and clearer still. Custom templates can be built with JavaScript and HTML, while taking care that the code is well optimised in the browser. In this post we will look at the predefined templates.
Custom templates are tag templates you can either build and configure yourself or pick from predefined ones uploaded to the gallery by other users. These are mainly third-party measurement templates such as the Facebook Pixel, Hotjar and so on, where HTML is used.

The UI alone is a large difference. Being able to adjust something immediately, without hunting through code, minimises problems during setup.
Templates have another, less visible but important function. In short, Google checks whether the templates contain any malicious software.
These templates are found under the "Templates" tab, where we then choose "Search Gallery".

Here is the selection of templates that can be added from the official Google Templates site. At our agency we use the templates for Adform, AppNexus, Facebook Pixel, Glami, Shopalike and Reddit most.
When we choose a template to add, Facebook for instance, Google warns us that the template injects third-party scripts.

These templates can then be edited. In many cases it is no longer worth it, though, since they are very well tuned.
First we find Simo Ahava's Facebook Pixel in the gallery.



Then we go to the Tags tab. We create a new tag and choose Facebook Pixel from the "Custom" section.

We add the Facebook Pixel ID and choose which event we want to send. There are three options:
There is also a "Consent Granted (GDPR)" field. The point is that if it is set to "False", the pixel will send no information until a tag fires where "Consent Granted" is set to "True". You can read more about this field here.
If we tick the "Enable Advanced Matching" checkbox we can send parameters such as city, date of birth, email address and so on — from forms, for instance. The "Enable User Properties" checkbox means we will send a User ID, which has to be in the format given in this documentation.
Under "More Settings" we find the option to disable automatic configuration. It means Facebook automatically gathers certain metadata, such as user interactions. Ticking it disables the pixel's automatic configuration.
The last tab, "Advanced Settings", holds the advanced settings every tag in GTM has.
I chose the predefined ViewContent event. When we want to send event parameters too, we open "Object Properties". Here we can choose whether the data should be pulled from a variable (if we were sending all the information into a single variable), or leave it "False" and click "Add property", where we can add variables for the ViewContent event.
The parameters would then look like this:

In the end the pixel might look like this:

I trust this article has helped you understand templates in GTM. Using templates rather than HTML has the large advantage of minimising the risk of errors when copying and editing code. It also makes setting up conversion tracking easier and simpler for many people.
The latest trends, proven practices and analyses from the digital world. Find out how to take your technology and marketing growth further.
And don't forget to check out Invelity Extras – you'll find a marketing glossary, useful tools and plugins to make your work easier!
Invelity Extras