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.
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.
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.
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.
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.
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.
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.