#GTMTips: Build a Custom Universal Analytics Client for Server-Side Tagging

You can utilize Server-side tagging in Google Tag Manager to build your own custom Universal Analytics proxy. This proxy comes in the shape of a new Client custom template, which takes the incoming /collect requests and sends them to Google Analytics. While doing so, it also returns the _ga cookie in a Set-Cookie header, thus preventing Safari’s Intelligent Tracking Prevention from capping its expiration to just 7 days. You might also be interested in reading what Google’s own solution is for migrating from JavaScript cookies to those set in HTTP headers. Read More…

Cookieless Tracking for Cross-Site Iframes

Updated 25 May 2021: Added information about using this with GA4. As Google Analytics 4 does not have a mechanism to disable cookie storage, only the second solution (send dataLayer events from iframe to the parent) described in this article will work for GA4. Here I am, back with <iframe> and cross-domain tracking. I’ve published a couple of articles before on the topic, with my upgraded solution being the most recent one. Read More…

Universal Analytics: Fire Script Just Once per Session

There is a new version of this post for GTM V2 here. While going over my previous post about using weather conditions to segment data in Google Analytics, I started thinking about performance issues. Since I’m using a visit-scope custom dimension, it seems futile to have it send the weather details with every single page load. The odds of the weather changing drastically during one visit are slim (unless you live in the UK), and I have yet to come up with a good reason to change my on-site behavior because the weather changed from a drizzle to a downpour. Read More…