Since the introduction of custom templates in May 2019, the community (myself included) has been anxiously waiting for some official solution for curating and distributing templates created by the community. Now, finally, we have it. It’s called the Community Template Gallery! Read Google’s announcement in this blog post. I’m not going to go over the basics in this article, since Google’s own documentation stands fine on its own feet.
I’ve enjoyed working with custom templates for Google Tag Manager. A lot. So much so that whenever the need to add some custom code to a container emerges, my first thought is how to turn that into a custom template. Google has been forthcoming in introducing new APIs steadily, and I think the variety of things you can do with template is improving with every new API release. In this article, I’ll show you how to use a simple tag template for distributing your users to groups, based on a random split.
When Custom Templates were released in Google Tag Manager, many of us active in the GTM communities started doing two things: 1) creating our own custom templates, and 2) waiting patiently for Google to release a “gallery” or “library” for distributing these community contributions. While I have full faith in the latter happening some time in the future, I thought it would be fun to create something similar to a library, and then open-sourcing it for the community to help out with or to download locally for their own purposes.
Google Tag Manager is strictly a tag delivery system, and it’s very careful not to collect any analytics data on its own. This is most likely a deliberate choice, because if GTM was to start collecting data, it would introduce additional barriers to adoption. Nevertheless, being a tool that consolidates the design, development, deployment, and testing of all the marketing and analytics pixels, code snippets, and utilities running on a website or a mobile app, lacking the necessary features for auditing and monitoring has always seemed like an oversight.
After the recent release of Custom Templates for Google Tag Manager, my mind has been occupied by very little else. However, I have a nagging feeling that due to how involved the feature set is, there’s still a lot of demystifying that needs to take place before templates are fully embraced by the GTM user base. In this article, I want to show you a concrete example of template creation.