Trigger Guide for Google Tag Manager

Updated 27 March 2019 In the new version of Google Tag Manager, one of the most visible and profound changes to the previous version is how tags are fired (and blocked). First of all, there’s the obvious terminological distinction: we talk about triggers now, not rules. Second, triggers have become an integral part of the tag creation workflow, and as such have far more significance in the user interface than before. Read More…

Check if Google Analytics Is in the Page Template

One of the recurring problems in migrating to Google Tag Manager is how to make the transition as smooth as possible. Usually it requires that we agree with the developers on a time when the old code is removed, and at that moment we need to make sure the GTM tags point to the right UA code. This is, of course, only one use case for migrations, as some people do the entire migration in a staging environment, and some just don’t care if they lose a little bit of data along the way. Read More…

Simple RegEx Table for Google Tag Manager

When our good friends in the Google Tag Manager developer team first introduced the Lookup Table Macro, we were excited. For many of us, it soon became the weapon of choice especially when used as a management and optimization tool for the container itself. However, the macro wasn’t considered perfect. In fact, the most frequently heard request had to do with the core functionality of the feature itself: the macro should support operations, that is, predicate logic. Read More…

#GTMtips: Fix Problems With GTM Listeners

I’ve written about this before here and here, but this issue remains probably the biggest problem users have when implementing Google Tag Manager. Tip 10: Resolve conflicts with GTM’s listeners The tip title is actually wrong. You’re not fixing Google Tag Manager listeners. Rather, you’re resolving conflicts that other scripts on your page might introduce. GTM’s event listening is based on something called event delegation. Event delegation makes use of the document object model (DOM) and its tree-like hierarchy. Read More…

Google Analytics and the Page Load

If you use Google Analytics, Google Tag Manager, or any JavaScript-based data collection or analytics platform, have you ever stopped to wonder how they actually work? I mean, you obviously care about getting the data in, but are you taking the machinations of these tools for granted? This is something I’ve been thinking about for a long while, because I’m not so sure that many who work with these platforms actually understand how the browser and the web page interact. Read More…

Auto-Event Tracking in GTM 2.0

In the new version of Google Tag Manager, auto-event tracking has received a considerable usability upgrade. It might seem quirky at first, especially if you’re used to the old auto-event tracking method, but the logic behind the new setup is brilliant. The most important distinction is that auto-event tracking isn’t something you control with separate tags anymore. Rather, it’s now entirely trigger-driven, meaning you activate and specify the auto-event tracking of your choice using tag triggers (triggers are what ye olde folk used to call rules). Read More…

ECommerce Tips for Google Tag Manager

I’ve noticed that setting up eCommerce in Google Tag Manager (and now the new Enhanced ecommerce) is very difficult for many. I’m sure part of the problem is that eCommerce is for many users the moment that GTM forces you to take steps in to the developer’s domain, since it’s obvious that you’ll need to add some code to the web page. This isn’t a tutorial on how to do eCommerce in Google Tag Manager. Read More…

#GTMtips: HitCallback and EventCallback

This time we’ll take a look at two different, JavaScript-y features of Google Analytics and Google Tag Manager. Callback as a concept should be familiar to anyone who’s ever used a programming language. It’s basically a piece of code that is passed as an argument to some function, so that when this second function has completed, the callback is executed. For web analytics, callbacks are hugely important, since they allow you to impose a firing order for your asynchronous tags. Read More…

Google Tag Manager's Data Model

It’s time for MeasureCamp again! As before, I want to write an accompanying post for my session, since there’s always so much more to say than the time slot allows for. So, the topic of this article is the data model used by Google Tag Manager to process digital data in your data layer. This post also picks up where I left in my previous foray into the data layer. However, where the first article aimed to be generic (since the data layer should be generic), this post will look at how GTM uses the information in the generic data layer, and how it processes this information to work with the proprietary features of the tool. Read More…

Use Page Visibility API With GTM

The Page Visibility API for web browsers is pretty sweet. It lets you poll, using some new properties of the document object, whether or not the current page is visible to the user. Visibility is hidden if the page is not open in the current browser tab instance, or if the browser window has been minimized. In this post, I’ll give an example of how features of the Page Visibility API could be used with Google Tag Manager. Read More…