DOM Scraping into Data Layer & Custom JS Variables

While Google Tag Manager is best used in conjunction with a data layer, there are many cases where it will make sense to more rapidly deploy tags by scraping the DOM instead. Generally this is because DOM scraping means using the elements that already exist on the page — the page titles, classes, IDs, URLs, … Read more DOM Scraping into Data Layer & Custom JS Variables

Get Visitor IP Address with Google Tag Manager

There are a few reasons you may want to access your visitors’ IP addresses using Google Tag Manager (GTM): to block internal traffic, set rules for firing tags, pre-fill form fields, etc. Tracking IP address with Google Analytics is also possible through this method, but not advisable as it may violate Google’s policies regarding personally identifiable … Read more Get Visitor IP Address with Google Tag Manager

Same web property ID is tracked twice

Google’s Tag Assistant plugin is an indispensable tool for troubleshooting various Google tags like Google Analytics, Google AdWords, and Google Tag Manager; just install and navigate to your site to enable checks for nearly 300 possible issues. This post will describe how to fix of one of the most common issues reported by this plugin: … Read more Same web property ID is tracked twice

Track Number of Search Results in Google Analytics with GTM

Tracking the number of onsite search results is useful for finding common searches for which few, or zero, results were returned, so that you can address gaps in your product or content offerings. This metric can also be used to analyze the correlation between search result counts and conversion rates. While the built-in onsite search … Read more Track Number of Search Results in Google Analytics with GTM

YouTube Video Tracking with Google Tag Manager

In September 2017, Google released native YouTube video tracking in Google Tag Manager (GTM), which makes setting up Google Analytics event tracking for YouTube super easy. This blog post shows the steps to add YouTube video tracking to GTM, or you can skip to the end and download and import the pre-configured setup into your … Read more YouTube Video Tracking with Google Tag Manager

GA Event Tracking in GTM – Pass-Through Data Layer

This is the third post in a series on design patterns for tracking events in Google Analytics (GA) using Google Tag Manager (GTM). This third pattern is a developer-focused implementation pattern where your site developers push all the required information into a data layer. This method is sometimes referred to as a “pass through” method. … Read more GA Event Tracking in GTM – Pass-Through Data Layer

GA Event Tracking in GTM – Custom HTML and JS

This is the second post in a series on design patterns for tracking events in Google Analytics (GA) using Google Tag Manager (GTM). This second pattern involves adding JavaScript through a Custom HTML tag. ❓GTM is a very flexible tool, opening up many potential implementation design patterns for tagging. There is a spectrum, where some … Read more GA Event Tracking in GTM – Custom HTML and JS

Google Analytics Event Tracking in Google Tag Manager

There are many types of site interactions you may be interested in tracking: scroll distance down a page, clicks on a hero image, email address submissions, and so on. All of these can be tracked using Google Analytics’ event tracking tags, which in turn can be set through Google Tag Manager (GTM). GTM is a … Read more Google Analytics Event Tracking in Google Tag Manager

Add Custom Metric to GA Using Google Tag Manager

Every report in Google Analytics contains dimensions and metrics. Dimensions describe the data, and metrics measure them. Custom metrics let you measure additional items beyond the default measurements like “sessions” and “total events”. It’s easy to overlook them because it’s often possible to get similar results in other ways (e.g. events + goals), but custom … Read more Add Custom Metric to GA Using Google Tag Manager

Regex to Match Number of Subdirectories in a URL

Using regex to match specific numbers of sub-directories in a URL can be very helpful for Google Analytics. When I configure a new Google Analytics view, I’ll usually set up Content Grouping so we can see traffic by page type rather than just to a specific page. Ideally there’s a value in the data layer … Read more Regex to Match Number of Subdirectories in a URL