#GTMTips: Automatic Page View Hits in SGTM After Consent Granted

If you’re using server-side Google Tag Manager, Google (Advanced) Consent Mode and you’re collecting hits to Google Analytics 4, you might have noticed something odd happening when switching consent to granted state. It looks as if your page_view hits as well as any other hits marked as “Conversions” (or key events now, I guess) are automatically redispatched to the server-side Google Tag Manager endpoint when consent is granted! This sounds incredibly useful. Read More…

#GTMTips: Consent Granted Reprocesses Previously Denied Hits

This will be a quick tip, but it’s here to correct my previous statements in the comments section of different articles on this blog. When using Advanced Consent Mode, Google Analytics 4 collects hits when consent is in "denied" state. These hits have a lot of parameters stripped off them, including identifiers like the Client ID and the Session ID. The hits will not surface in reports directly, but they will instead go through a modeling process to enrich the reports once modeled. Read More…

#GTMTips: Prevent SGTM From Setting the FPID Cookie

The FPID cookie is what server-side Google Tag Manager would prefer to use for your Google Analytics 4 tracking. It’s a cookie set in the HTTP response from the server, and it’s flagged as HttpOnly, which means it’s only accessible by a web server running on the domain on which it was set. There’s nothing wrong with the technology, and I do recommend that server-side setups toggle it on by default. Read More…

#GTMTips: Override Google Analytics 4 Fields in Server-Side GTM

Server-side tagging is all about control. Being able to intercept, modify, and even block requests as they come in before they are dispatched to their actual endpoints is extremely valuable. The built-in Google Analytics 4 tag template has options for modifying event parameters and user properties in the Google Analytics 4 request, but did you know you can use these options to modify some of the fields as well, such as Client ID, User ID, and event Engagement Time? Read More…

#GTMTips: Use GA4 Schema in Universal Analytics Ecommerce

With the sunset announcement of the Universal Analytics service, it certainly does seem like a waste of time to write articles about it. However, a recent update to Google Tag Manager is an interesting one and should provide relief to those Google Analytics users who are set on double-tagging their sites for both Universal Analytics and Google Analytics 4 and who want to make use of GA4’s new Data Layer schema. Read More…

#GTMTips: Preflight Requests in Server-Side Google Tag Manager

With certain types of HTTP requests, the web browser might first dispatch a request with the OPTIONS method, also known as a preflight request. The purpose of the preflight request is to “check” with the web server that it’s equipped to handle the type of cross-origin request the browser wants to dispatch. If the server doesn’t handle this preflight request, or if it returns a response that doesn’t agree with what the web browser wants to actually dispatch, the check fails and the browser refuses to send the actual request. Read More…

#GTMTips: Preview Requests in Server-Side Google Tag Manager

Server-side Google Tag Manager has an excellent Preview mode, which lets you inspect incoming requests, monitor the event data object, view console messages, and identify outgoing requests, among other things. To enable this Preview mode on the web, you simply need to click the Preview button in the container, after which any requests sent from the same browser instance will be automatically shown in the Preview mode window. However, what about if you want to send requests from another browser? Read More…

#GTMTips: Setup IAM for Manual Installation of Server-Side GTM

If you want to manually install server-side Google Tag Manager on App Engine in the Google Cloud Platform, you are of course welcome to do so. The main benefits of doing this are that you get to choose the region where App Engine is deployed and that you can use existing project resources instead of having a new project automatically created for you. However, to run the script without errors, there are a number of things you need to enable first. Read More…

#GTMTips: Setup a Google Tag Manager Server Using Cloud Run

While Google App Engine, the default implementation pattern of server-side Google Tag Manager, is straightforward to setup with the automatic provisioning steps, it’s certainly not the only way to deploy the server. You can set it up in Amazon AWS (this blog) You can set it up in Microsoft Azure (this blog) You can set it up with Cloud Run (Mark Edmondson’s blog) In fact, the manual setup guide gives you the details on how to deploy a Google Tag Manager Server in any environment that runs Docker. Read More…

#GTMTips: Manipulate Response Headers in Server-Side Google Tag Manager

Although most of Server-side Tagging in Google Tag Manager revolves, quite rightfully, around Clients, there’s still plenty of value to be derived from tags, too. Naturally, the most common use case for server-side tags is to map the incoming requests to the Server container (filtered through Clients) and dispatch them to their respective endpoints. But in addition to dispatching HTTP requests, tags can do so much more. In this article, I’ll share with you a neat way how to utilize tags to manipulate the HTTP responses the Server container sends back to the request source. Read More…