You are here: Tags / custom templates
Ever since it was released that server-side tagging in Google Tag Manager would run on the Google Cloud Platform stack, my imagination has been running wild. By running on GCP, the potential for integrations with other GCP components is limitless. The output to Cloud Logging already introduces interesting pipeline opportunities, but now it gets even better. It’s finally possible to write directly to Google BigQuery from a Client or tag template!

Continue reading

There’s a new custom variable template in town! The Data Layer Picker template lets you create variables that have a singular, exceptional (in Google Tag Manager’s context, at least) purpose: You can access the keys and values that were in the object pushed into dataLayer itself. And … that’s it! Read on to understand why this might be useful. Tip 123: Direct access to the dataLayer.push() If you know your Data Layer Variable, you’ll know that it comes in two versions.

Continue reading

Updated 3 March 2023: Added a checkbox to the template to enable collecting FCP, INP, and TTFB metrics, too.. Core Web Vitals is described on the dedicated web.dev resource as (emphasis mine): “Core Web Vitals are the subset of Web Vitals that apply to all pages, should be measured by all site owners, and will be surfaced across all Google tools.” Recommended Core Web Vitals thresholds - from https://web.

Continue reading

One of the big omissions, at least for now, in Google Analytics 4 is the customTask. It is unfortunate, but no such mechanism exists in the client-side SDKs. This means that you won’t be able to do all the magical things that customTask enables in Universal Analytics. One of the biggest headaches is how to collect extremely useful fields such as the Client ID, as these are not available by default in the Google Analytics 4 reporting interface.

Continue reading

When custom templates were released for Google Tag Manager, I updated my workflow for working with GTM. Instead of instinctively rushing to the Custom HTML tag and the Custom JavaScript variable, I started considering whether the custom script that needed to be deployed could be transformed into a custom template first. While publishing numerous templates into the community gallery, I always spent some time over the past 12 months tinkering on an extremely complicated template translation: the Snowplow Analytics JavaScript tracker.

Continue reading

Update 6 April 2020: I updated the template in the gallery to the latest version of the IP Geolocation API SDK, which no longer requires jQuery. Also, the SDK now handles API request caching to browser storage automatically, so the “Enable Session Storage” option was added to the template. Google Analytics had been foreshadowing the deprecation of the Network Domain and Service Provider custom dimensions since late 2019. On February 4, the plug was finally pulled, and both these dimensions started flatlining to (not set) in Google Analytics reports.

Continue reading

One of the prime things to use Google Tag Manager for is script injection. Loading a third-party JavaScript library is trivial to do with a Custom HTML tag, and works like a charm. However, using Custom HTML tags for, well, anything, is no longer the preferred way to add custom code to the site. Custom HTML tags are pretty expensive DOM injections, and they can be incredibly dangerous tools (for UX, security, and privacy) in the wrong and/or inexperienced hands.

Continue reading

Author's picture

Simo Ahava

Husband | Father | Analytics developer
simo (at) simoahava.com

Senior Data Advocate at Reaktor

Finland