#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…

Persist Campaign Data on the Landing Page

Universal Analytics utilizes two components (by default) to attribute a browser session to a specific campaign: query parameters in the URL and the referrer string. The page URL is sent with every hit to Google Analytics using the Document location field, which also translates to the &dl parameter in the Measurement Protocol. The referrer string is sent with a hit to Google Analytics using the Document referrer field, as long as the referrer hostname does not exactly match that of the current page and the referrer string is not empty. 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…

Writing Tests for Custom Templates in Google Tag Manager

Google Tag Manager introduced the capability to add tests to your Custom Templates. Tests, in this context, refer specifically to unit tests that you write in order to make sure your template code works in a predictable way. Unit tests are also used to drive development, ensuring that you have added contingencies for all the different scenarios that the template, when coupled with user input, might introduce. In this guide, I’ll introduce how the Tests feature works. Read More…

Calculate Readability Scores for Content

There are lots of different readability formulas out there, which seek to provide an index on how readable any given excerpt of text is. Typically, these formulas output a grade-level score, which indicates, roughly, the level of education required to read the text excerpt with ease. Any “quality index” that seeks to reduce the complexity of something as multi-faceted as reading should be subject to scrutiny. This is true for Bounce Rate, this is true for Time On Page, and this is true for a readability score. 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…

#GTMTips: The Mysterious .Macro() Call in Custom HTML Tags

When previewing Custom HTML tags in Google Tag Manager you’ve almost certainly run into a situation where the GTM variable shows up as a weird JavaScript method resembling something like this: google_tag_manager["GTM-ABCD123"].macro(15) And this is when you were expecting it to show the actual, resolved value! It doesn’t help that every now and then the preview mode actually shows to correct value in the preview mode. What’s up with that? Well, there’s a fairly logical explanation to this. Read More…

Improve Google Analytics Bot Detection With ReCAPTCHA

There are thousands upon thousands of bots, crawlers, spiders, and other creepy-crawlies out there doing nothing but crawling through websites and harvesting the content within for whatever purposes they have been fine-tuned to. While Google Analytics provides a bot filtering feature to filter out “spam” and “bot traffic” from views, this is far from comprehensive enough to tackle all instances of bot traffic that might enter the site. You might have noticed bot traffic in your data even if you have bot filtering toggled on. Read More…

Community Template Gallery for Google Tag Manager - Introduction and Tips for Use

Since the introduction of custom templates in May 2019, the community (myself included) has been anxiously waiting for some official solution for curating and distributing templates created by the community. Now, finally, we have it. It’s called the Community Template Gallery! Read Google’s announcement in this blog post. I’m not going to go over the basics in this article, since Google’s own documentation stands fine on its own feet. Read More…

Still Running Google Tag Manager Tags: What to Do?

Sometimes, in Google Tag Manager’s Debug mode, you’ll see tags appear with the status Still Running, and you’ll (eventually) notice that these tags are not doing what they are supposed to be doing. When you see this message on a tag, it technically means this: The tag failed to signal Google Tag Manager that it is “done”. The technical explanation is, naturally, too simple to be useful. In this article, I’ll explore what “done” means, and how especially Google Analytics tags manifest this behavior. Read More…