Add Client ID to Custom Dimension With Gtag.js

When Google released gtag.js, the new, global tracking library designed to (eventually) replace analytics.js, many Universal Analytics practitioners and users were confused (see e.g. Jeff’s great overview here). It seemed like gtag.js wasn’t really solving any immediate problem, since analytics.js had done a bang-up job with Universal Analytics tracking for all these years. However, gtag’s modus operandi is the ability to leverage the same semantic information (distributed across dataLayer!) across a number of Google products, starting with GA and AdWords. Read More…

#GTMTips: Add a Load Listener to Script Elements

One of the challenges in working with Google Tag Manager (or any JavaScript-based platform for that matter) is what to do with race conditions. A race condition emerges when you have two resources competing for execution in the browser, and there is a degree of unpredictability to which “wins” the race. A prime example is working with jQuery. It’s one of the most popular JavaScript libraries out there, and websites utilize it for a multitude of things, many useful for Google Tag Manager, too. Read More…

Send Event and Custom Dimension if Google Optimize Experiment Is Running

I really like Google Optimize. It has a fairly intuitive UI, setting up experiments is easy, and there’s integrations for both Google Tag Manager and Google Analytics built into the system. It’s still a JavaScript-based, client-side A/B-testing tool, so problems with flicker and asynchronous loading are ever-present (though this is somewhat mitigated by the page-hiding snippet). One issue with the Google Analytics integration is the difficulty of creating segments for sessions where the users were actively participating in the experiment. Read More…

#GTMTips: Respect Opt-Out From Advertising and Analytics

With GDPR looming around the corner, it’s time to explore the options you have at your disposal for respecting the new, stricter regulations for tracking users and for collecting data about their visits to your website. UPDATE 20 June 2018: Google has released the allowAdFeatures field which renders the solution below redundant (at least for the displayFeaturesTask part of it). Please refer to this article for more details on how to conditionally block the advertising hit to DoubleClick. Read More…

The Scroll Depth Trigger in Google Tag Manager

Scroll depth tracking in web analytics is one of those things you simply must do, especially if you have a content-heavy site. Tracking scroll depth not only gives you an indication of how much users are digesting your content, but it also lets you turn meaningless metrics such as Bounce Rate into something far more useful. If you’ve already been tracking scroll depth in Google Tag Manager, you’ve probably been using either Rob Flaherty’s brilliant Scroll Depth jQuery plugin, or Bounteous’ equally ingenious Scroll Tracking recipe. Read More…

The Element Visibility Trigger in Google Tag Manager

Holy visibility, Batman! Visibility is a seriously undervalued aspect of web analytics tracking. Too often, we fall into the trap of thinking that “Page Views” actually have something to do with “viewing” a page. Or that tracking scrolling to 25%, 50%, or 75% of vastly different pages makes sense on the aggregate level. So you will be very pleased to know that the Google Tag Manager team (who have been on FIRE recently), have just published the Element Visibility trigger. Read More…

Happy 5th Birthday Google Tag Manager!

5 years ago, on 1st October 2012, this lovely video popped up in Google’s Analytics Blog: It was accompanied by a blog post, which contained a brief look into many of Google Tag Manager’s key features, some of which are still relevant today. At this time, those of us who started using the tool immediately, or who had been beta-testing it, saw quickly what the key selling point of GTM was. Read More…

Prevent Site Speed Sampling Rate From Skewing Custom Dimensions and Custom Metrics

Universal Analytics can collect Page Timing data from users that load your pages. This data is populated in to the Behavior -> Site Speed -> Page Timings report, and it’s a very useful feature for optimizing your website. However, there’s a murky underside to this generous feature. The way Page Timings collection works is that when Pageview hits are sent from the site, a sample of these (1% by default) are automatically followed by a timing hit which includes page performance data grabbed from the Navigation Timing API. Read More…

The RegEx Table Variable in Google Tag Manager

Ever since the Lookup Table variable was introduced in Google Tag Manager, users have been craving for more. The Lookup Table does exactly what it promises: lookups. These are exact match operations, which are extremely inexpensive to perform, because they can only have a binary result: either the match exists in the data store being queried or it doesn’t. This performance stays constant even if the data store being queried increases in size. Read More…

The Myth of the Non-Technical Marketer

There’s a fabled, mythical beast that prowls the jungles of digital marketing. They have no issues with running and analyzing crawler data, offering suggestions for server-side redirects, building remarketing audiences, implementing tag management solutions, speaking of Data Layers, copy-pasting code from Stack Overflow, configuring bid managers, and speaking at conferences presenting on all the aforementioned activities. However, for some reason, they still claim that they are “non-technical”, or “just marketers”. Read More…