#GTMTips: Edit Google Analytics Tag Settings

When the Google Analytics Settings variable was introduced in May 2017, it resulted in a significant change in the Google Analytics tag user interface in Google Tag Manager. The default UI for editing a tag was stripped down of all GA-specific settings, and the new Google Analytics Settings drop-down was the replacement.

Unfortunately, the bulk of Google Tag Manager articles online (including those on this blog) still refer to the old interface in screenshots and instructions. This #GTMTips article is a very quick tip to show you how to reveal tag-specific settings without using a Google Analytics Settings variable.

Read More…

#GTMTips: Fix Missing Page View Event and Broken Triggers

Google Tag Manager should be relatively easy to implement. Just paste the container snippet to the <head> of the page and you’re good to go! However, at some point you’ll want to configure the dataLayer structure, too (read more about dataLayer here). There are two ways to do it: the right way and the wrong way.

In this article, we’ll see what happens if you do it the wrong way, how to identify the issue, and how to fix it.

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. Everything is designed to run over Amazon Web Services, so you don’t need to invest in local server hardware or hosting services.

Read More…

#GTMTips: Simple Custom Event Listeners With Google Tag Manager

First of all, check out this article for an overview of how custom event listeners work in Google Tag Manager. The reason I’m writing this #GTMTips article is that I want to upgrade the solution slightly, and I want to bring it back into the spotlight. Why? Because it’s still one of the most effective ways to customize your Google Tag Manager implementation.

A custom event listener is a handler you write with JavaScript. It lets you handle any JavaScript DOM events, such as click, form submit, mouse hover, drag, touch, error, page load and unload, and so many more. It also lets you leverage the useCapture parameter which will prove very helpful if you have other JavaScript on the site interfering with GTM’s default event triggers.

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. To make it work, we’ll use a Custom HTML tag together with some tag sequencing.

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…

#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. For example, jQuery trivializes asynchronous HTTP requests and DOM traversal, both of which can cause headaches to GTM users.

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…

#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. The tip is for Google Tag Manager, but with very little modifications it will work with Universal Analytics, too.

Read More…

#GTMTips: Pagination and Quick Search

If you open the Google Tag Manager user interface and browser your tags, triggers, and variables, you might notice that the UI now has two new features:

  1. Pagination, where only 50 results are shown per page

  2. A quick search / filter bar at the top of each list, which lets you narrow the list down to results that match your query

Pagination might be a nuisance in large containers, but it was implemented to improve performance. Fetching the list of assets and rendering them on the screen can be a pretty hefty amount of API work, especially if the container is bloated. By introducing pagination, only 50 items are processed at a time, which speeds up the UI. However, being forced to plow through pages of assets can get tedious.

Read More…