#GTMTips: Add Hit Type as a Custom Dimension

I’ve spent a considerable amount of time talking and writing about how to improve the granularity of your Google Analytics data, especially when using Google Tag Manager. I’ve also gone on and on and on (and on) about customTask, which makes adding metadata to the Google Analytics hits dispatched from your website a breeze. In this article, I’ll introduce a simple way to add yet another level of detail to your GA hits, using customTask as the method of choice. Read More…

Send Google Analytics Payload Length as Custom Dimension

Maybe you knew this, maybe you didn’t, but requests sent from your website (or app) to Google Analytics have a maximum size. Or, more specifically, the payload size (meaning the actual content body of the request) has a maximum. This maximum size of the payload is 8192 bytes. This means, basically, that the entire parameter string sent to Google Analytics servers can be no longer than 8192 characters in length. The thing is, if the payload exceeds this, Google Analytics simply drops the hit. Read More…

CustomTask - The Guide

Last updated 4 September 2018 If you have been reading my blog articles over the past year, you might have noticed a disturbing trend. I’ve published 9 articles on customTask since the API was released. It might not sound like much, but I can’t think of a single feature in Google Analytics or Google Tag Manager that has so completely convinced me of its usefulness in such a short time. Read More…

#GTMTips: Automatically Duplicate Google Analytics Hits to Snowplow

I’m back with another customTask tip, but this time I’m exploring some new territory. Snowplow just introduced their latest version update, which included (among other things) an adapter for processing Google Analytics payloads. Never heard of Snowplow? It’s a collection of open-source libraries designed to let you build your own analytics pipeline, all the way from data collection, through ETL (extract, transform, load), using custom enrichments and JSON schemas, and finally into your own data warehouse, where you can then analyze the data using whatever tools you find preferable. Read More…

#GTMTips: Opt-Out of Google Analytics Tracking

A while ago I posted a #GTMTips post where I detailed the steps you can take to opt-out of all Google Analytics tracking and the DoubleClick redirects that often follow. It was a fun exercise, but because it relies on preventing requests on a tag-by-tag basis (using the ubiquituous customTask), it can be a chore to handle in large containers. In this article, we’ll continue with the theme of opting out from Google Analytics tracking by leveraging a solution provided by the tool itself. Read More…

#GTMTips: Auto Link Domains With Regex

Update 5 March 2019 due to GTM not supporting negative lookbehinds any more. Google Tag Manager makes it fairly easy to do cross-domain tracking. Basically, you list the hostnames you want to automatically decorate with linker parameters in the Auto-Link Domains field of your Page View tag, and that takes care of decorating the URLs with the necessary parameter. It’s dead easy, even if there are a bunch of traps you need to watch out for (see my post on troubleshooting cross-domain tracking issues). 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…

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…

#GTMTips: Remove PII From Google Analytics Hits

Sending personally identifiable information (PII) to Google Analytics is one of the things you should really avoid doing. For one, it’s against the terms of service of the platform, but also you will most likely be in violation of national, federal, or EU legislation drafted to protect the privacy of individuals online. In this #GTMTips post, I’ll show you a way to make sure that any tags you configure this solution with will not contain strings that might be construed as PII. Read More…