Custom Templates for Google Tag Manager

One of my passion projects has been to create custom templates for Google Tag Manager’s community template gallery.

On this page, I’ll list all the custom templates I’ve created for the gallery, as well as provide a link to each template’s individual documentation page.

Do you need help with your template?

If you want to commission me for help building your custom template, please contact me at simo (at)

Remember to also check out my articles on custom templates.

Client templates (0)

Tag templates (22)

Consent Mode (Google tags)

This is a template for deploying Google tags’ Consent Mode functionality. It lets you deploy Consent Mode with both the “default” and “update” commands.


This tag adds measurements for Core Web Vitals (LCP, FID, CLS), and pushes them into dataLayer once each is collected.

Cookie Monster

This Server container tag template can be used to set (or rewrite) any browser cookie in the HTTP response.

Adform Tracking Point

This is an unofficial template for the AdForm Tracking Point. You can use it to load the SDK, initiate the tracking point, and to send page- and order-level data to AdForm.


This tag writes into dataLayer selected default and custom fields set with tags that utilize the gtag.js library; Google Analytics 4, for instance.

Transaction ID Logger

This tag stores the Transaction ID provided by the user in a browser cookie and/or localStorage.

Facebook Pixel

This is an unofficial template for the Facebook Pixel. You can use it to load the SDK, initiate the pixel(s), and to send custom and standard events to Facebook with any custom properties and user attributes you wish.


The is an unofficial template for Userpilot. The tag can be used to identify users (with an ID and associated properties), reload Userpilot and re-evaluate page state, track custom events, and trigger specific Userpilot content for the user, regardless of targeting conditions.

User Distributor

You can use this tag to randomly assign users to buckets, and then to store this information in a first-party cookie. This is useful for quick A/B tests and for creating samples or cohorts of your visitors.

Facebook Customer Chat

This is an unofficial template for the Facebook Customer Chat SDK. You can use it to load the chat SDK and to attach event handlers to the API events.

Snowplow Analytics

This is the official template for the Snowplow Analytics SDK. It supports the full spread of features for the JavaScript tracker, with a few exceptions due to the sandbox of custom templates.

IP Geolocation API

This is an unofficial template for the IP Geolocation API. With this API, you can query for geolocation data using the user’s (or a custom) IP address. This information is then written into dataLayer.

Persist Campaign Data

This tag stores the page referrer and URL parameters in a browser cookie. This cookie can be used, for example, on conversion pages or after the user has given consent to attribute the session to the correct campaign. The template also stores the original location of the page to overcome the rogue referral problem on single-page applications.


This is an unofficial template for Qualaroo. You can use this template to initialize the Google Analytics integration, and you can use all of the available Qualaroo JavaScript APIs as well.

YouTube iframe API loader

The is an unofficial template for the YouTube Iframe API. A tag created with this template loads the YouTube Iframe API on the page. This is necessary if you want to track interactions in lazy-loaded or dynamically added videos with Google Tag Manager’s native YouTube video trigger.

Google Tag Manager Monitor

Use this template to set up a monitoring system for Google Tag Manager. With the monitor, you can collect data about tags that fired (or did not fire) with any given event. This information can be used to proactively fix issues with your tags.


This is an unofficial template for the AdService SDK.


This is an unofficial template for the AppNexus pixel.


This is an unofficial template for the Conductrics library. You can use it to load the SDK/API on your site.

Variable templates (9)

Data Layer Picker

A variable template with which you can access the key-value pairs that were present in the dataLayer.push() that caused the tag to fire.

URL Parser

The URL Parser (Server Container) variable template can be used to parse URL parts out of any URL string passed as input. It works by default with the page_location field in the event data object.

sha256 Hasher

Use the sha256 Hasher template to generate a SHA256 hash (encoded with base64 or hex) of any input string

Transaction ID Reader

Designed to work with the Transaction ID Logger tag template, this variable template reads Transaction IDs stored in a browser cookie or localStorage.

EEC Products -> GA4 Items

This variable template takes an Enhanced Ecommerce products/impressions/promotions array as an input, and outputs it in the updated “items” format for Google Analytics 4 Ecommerce.

Snowplow Analytics Settings

This template is meant to be used with the Snowplow Analytics tag template. It generates a tracker configuration object for the tag, thus removing the need to configure the tracker manually for every single Snowplow Analytics tag in the container.

URL 2.0

This template can be used to replace the built-in URL variable type. It has additional options, such as building the string from different URL components, and for parsing the URL fragment for key-value parameters as well.

String from array of objects

This template takes an array of objects, and produces a string where the values of one of the given keys in these objects is concatenated into a single string.

Enhanced Ecommerce Object Builder

Use this template to build an Enhanced Ecommerce object, compatible with Universal Analytics. This way you do not necessarily have to use the dataLayer at all for populating Ecommerce data into Universal Analytics.