#GTMTips: Send Google Analytics Requests to Custom Endpoint

When you use Google Analytics on the web, you are most likely implementing one of analytics.js, the global site tag (gtag.js), or Universal Analytics tags via Google Tag Manager. These libraries all end up doing the same thing: compiling a payload-rich HTTP request to an endpoint at https://www.google-analytics.com. What if you want to have the JavaScript libraries do their job, but instead of sending the data to Google’s servers, you send them to a new, custom endpoint? Read More…

#GTMTips: Fix Container Preview in Google Chrome's Incognito Mode

Since updating to Google Chrome 83, you might have noticed that Google Tag Manager’s Preview mode no longer works when browsing Chrome in Incognito mode. This is because starting with Chrome 83, third-party cookies are blocked by default in Incognito windows. Google Tag Manager uses third-party cookies to serve browsers in Preview mode with the container draft rather than the live container. There’s a simple workaround to make sure Preview mode continues working for any site you want to browse in Preview mode. Read More…

#GTMTips: Use an All Events Trigger for More Control

One of the most versatile triggers in Google Tag Manager is the Custom Event trigger. As its name indicates, you can use it to fire your tags when an event is pushed into dataLayer. This process is at the heart of GTM’s dataLayer system. And it’s not just custom events. Every single trigger type in Google Tag Manager uses the event key in a dataLayer.push(), which is why you’ll see events like gtm. Read More…

#GTMTips: Use Gtag.js Parameters in Google Tag Manager

With the proliferation of gtag.js implementations, we can see that there’s a small-ish paradigm shift in how to implement Google’s stack of marketing tools. As adding gtag.js snippets to the site code becomes more and more common (to cater to things like early Optimize loading), you might be at a point where you have lots of interesting information stored in the gtag.js queue but no way to access it in your Google Tag Manager tags and variables. Read More…

#GTMTips: Why Does the Google Analytics Tag Show 'Failed'

I’ve covered the more pervasive issue with tags not firing in Google Tag Manager in my article on the “Still Running” status. However, there’s an additional problem you might face with Google Analytics: tags that show status Failed, and which refuse to send any data to Google Analytics. There are a couple of possible reasons for this, and we’ll explore them in this article. Note that any tag type in Google Tag Manager can signal Failed. Read More…

#GTMTips: Keep IOS and Android Firebase Containers in Sync

With iOS and Android containers available for Google Tag Manager, it’s tempting to add GTM as an integration into an existing Firebase setup for your apps. It’s also a fine way to get acquainted with Firebase in the first place, as it has a plethora of features to make application development easier. Furthermore, with the advent of App + Web, there’s even more incentive to integrate your app with Firebase. Read More…

#GTMTips: Collect ISP as a Custom Dimension in Google Analytics

Update 6 April 2020: I updated the template in the gallery to the latest version of the IP Geolocation API SDK, which no longer requires jQuery. Also, the SDK now handles API request caching to browser storage automatically, so the “Enable Session Storage” option was added to the template. Google Analytics had been foreshadowing the deprecation of the Network Domain and Service Provider custom dimensions since late 2019. On February 4, the plug was finally pulled, and both these dimensions started flatlining to (not set) in Google Analytics reports. Read More…

#GTMTips: Chrome Samesite Warnings for Google Tag Manager

Update 17 February 2020: Google Tag Manager’s Preview mode cookies have been updated with the necessary flags, so they will not break once SameSite enforcement begins. If you’ve opened the browser console in Google Chrome (since Chrome 76), you might have seen a bunch of warnings in a yellow background related to something called a SameSite cookie attribute that is either missing or incompletely set for cookies set on external domains. Read More…

#GTMTips: Walkthrough of Custom Template Tests

Google Tag Manager now lets you add unit tests directly to your custom templates. This is useful, since it allows you to control the code stability of your templates, especially if you’ve decided to share those templates with the public. I recently shared a general guide for how template tests work, but I wanted to expand the topic a little, and share with you two walkthroughs of custom template tests: one for a variable template and one for a tag template. Read More…

#GTMTips: Track Outbound Link Clicks in Google Tag Manager

I’ve written about outbound link click tracking before. It’s a very solid way to track interactions on the site, as clicking a link that leads away from a site is a signal of … well, something. In Google Tag Manager it’s now extremely easy and efficient to track outbound link clicks, thanks to the introduction of a new configuration in the Auto-Event variable. This article will introduce the new method and show you how you can quickly set it up! Read More…