Google Tag Manager and Google Analytics
Simo Ahava is a Google Developer Expert for Google Analytics and Google Tag Manager. This is a blog all about web analytics development.
Google Tag Manager users received an email on March 11th, where Google announced a very cryptic update to Google Tag Manager: As is typical with Google’s email communications, the email raised more questions than it answered. Even though I tackled the email in a LinkedIn thread, there’s still a lot of misunderstanding (and misinformation) going about. In this short article, I’ll explain what Google is going to do on April 10th.
One of the most popular use cases for server-side Google Tag Manager, often shared on this blog, too, is to split an incoming stream into multiple different endpoints. Since the demise of customTask for Universal Analytics (Rest In Peace!), there hasn’t really been a solid, officially supported way of splitting a single GA4 stream into multiple endpoints. This is useful in case you want to create a “global rollup” property that combines data from multiple local sites, for example.
One of the most popular use cases for server-side Google Tag Manager, often shared on this blog, too, is to split an incoming stream into multiple different endpoints. Since the demise of customTask for Universal Analytics (Rest In Peace!), there hasn’t really been a solid, officially supported way of splitting a single GA4 stream into multiple endpoints. This is useful in case you want to create a “global rollup” property that combines data from multiple local sites, for example.
There are many reasons why you might want to duplicate your tags (or triggers, or variables, or templates) in Google Tag Manager. One prime example is server-side tagging, where it’s sensible to first build and validate your tracking setup before migrating fully to a server-side approach. Alternatively, you might want to collect analytics data to a second property, for example when you want to have a local and a global dataset for site visit data.
There are many reasons why you might want to duplicate your tags (or triggers, or variables, or templates) in Google Tag Manager. One prime example is server-side tagging, where it’s sensible to first build and validate your tracking setup before migrating fully to a server-side approach. Alternatively, you might want to collect analytics data to a second property, for example when you want to have a local and a global dataset for site visit data.
In this guide, I’ll show you how to add first-party cookie values client-side, which your server-side Google Tag Manager processes can then access. You might be wondering: “Why bother?”. After all, if server-side GTM is running same-site with the website sending the requests, why can’t it just read the cookies on its own, right? Well, true. But there are cases where the website and web server seem to be same-site but are in fact not.
In this guide, I’ll show you how to add first-party cookie values client-side, which your server-side Google Tag Manager processes can then access. You might be wondering: “Why bother?”. After all, if server-side GTM is running same-site with the website sending the requests, why can’t it just read the cookies on its own, right? Well, true. But there are cases where the website and web server seem to be same-site but are in fact not.
There are two new custom templates available in server-side Google Tag Manager. These templates have been designed to facilitate Piwik PRO tracking in a server-side container. Piwik PRO Client -> This Client template interacts with the Piwik PRO JavaScript tracker and lets you route Piwik PRO tracking through a server-side GTM container. GitHub repo. Piwik PRO -> The tag template works in unison with the Piwik PRO Client, forwarding the hits to the Piwik PRO endpoint.
There are two new custom templates available in server-side Google Tag Manager. These templates have been designed to facilitate Piwik PRO tracking in a server-side container. Piwik PRO Client -> This Client template interacts with the Piwik PRO JavaScript tracker and lets you route Piwik PRO tracking through a server-side GTM container. GitHub repo. Piwik PRO -> The tag template works in unison with the Piwik PRO Client, forwarding the hits to the Piwik PRO endpoint.
Piwik PRO has two new server-side Google Tag Manager templates, and this article explains what they are and how they work. The first template, Piwik PRO Client, is designed to work in unison with the Piwik PRO HTTP API. Most often these requests are generated by the Piwik PRO JavaScript tracker, but theoretically any HTTP source that uses the same schema can send requests for the Client to claim. Once the Client claims the request, it generates an event data object that can be consumed by tags in the server-side Google Tag Manager container.
Piwik PRO has two new server-side Google Tag Manager templates, and this article explains what they are and how they work. The first template, Piwik PRO Client, is designed to work in unison with the Piwik PRO HTTP API. Most often these requests are generated by the Piwik PRO JavaScript tracker, but theoretically any HTTP source that uses the same schema can send requests for the Client to claim. Once the Client claims the request, it generates an event data object that can be consumed by tags in the server-side Google Tag Manager container.
Google has released a new feature, First-Party Mode (FPM), into public beta. Image source First-Party Mode seeks to make it easier to wrap Google’s measurement and advertising technologies in a first-party, same-origin context. This means that the user’s browser, when visiting a website running FPM, would no longer communicate directly with Google’s domains when fetching measurement libraries such as Google Tag or Google Tag Manager. Instead, the requests would be sent to a subfolder of the website itself.
Google has released a new feature, First-Party Mode (FPM), into public beta. Image source First-Party Mode seeks to make it easier to wrap Google’s measurement and advertising technologies in a first-party, same-origin context. This means that the user’s browser, when visiting a website running FPM, would no longer communicate directly with Google’s domains when fetching measurement libraries such as Google Tag or Google Tag Manager. Instead, the requests would be sent to a subfolder of the website itself.
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.
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.
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.
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.
Simmer has just released the Technical Marketing Handbook. It’s a free online resource, formatted as a mini-course, designed to walk the reader through the different disciplines and concepts that fall under the banner of “technical marketing”. And yes, we spend the introductory chapter explaining what that term means to us. In total, we wrote 9 chapters, each with 3 topics, for a total of around 77,000 words. For reference, that’s about as many words as in the first Harry Potter novel.
Simmer has just released the Technical Marketing Handbook. It’s a free online resource, formatted as a mini-course, designed to walk the reader through the different disciplines and concepts that fall under the banner of “technical marketing”. And yes, we spend the introductory chapter explaining what that term means to us. In total, we wrote 9 chapters, each with 3 topics, for a total of around 77,000 words. For reference, that’s about as many words as in the first Harry Potter novel.
**Last updated March 7, 2024. Clarified that you do NOT need to resend hits when consent is granted, if those hits were collected on the same page when consent was denied. Google’s Consent Mode continues to be a hot topic, especially since in 2024 it will be required to implement Consent Mode in case a website or app is collecting data for audience building or remarketing with Google’s advertising services.
**Last updated March 7, 2024. Clarified that you do NOT need to resend hits when consent is granted, if those hits were collected on the same page when consent was denied. Google’s Consent Mode continues to be a hot topic, especially since in 2024 it will be required to implement Consent Mode in case a website or app is collecting data for audience building or remarketing with Google’s advertising services.
As my LinkedIn inbox graciously reminded me that I’ve been working on Simmer for a full three years now, I’d like to share a couple of observations about education – particularly in the world of technical digital marketing. Online courses are an interesting vehicle for education. The medium offers a plethora of different approaches to knowledge transfer, student assessment, and collaboration. It seems like a no-brainer in today’s day and age, particularly for someone who wants to build a platform that scales beyond in-person tuition.
As my LinkedIn inbox graciously reminded me that I’ve been working on Simmer for a full three years now, I’d like to share a couple of observations about education – particularly in the world of technical digital marketing. Online courses are an interesting vehicle for education. The medium offers a plethora of different approaches to knowledge transfer, student assessment, and collaboration. It seems like a no-brainer in today’s day and age, particularly for someone who wants to build a platform that scales beyond in-person tuition.
This is a template for deploying Google tags’ Consent Mode functionality. It lets you deploy Consent Mode with both the “default” and “update” commands.
This is a template for deploying Google tags’ Consent Mode functionality. It lets you deploy Consent Mode with both the “default” and “update” commands.
I am fortunate to share another guest post by Arben Kqiku, Digital Analyst at Assura. Last time, Arben graced this blog with a comprehensive love letter to R as an example of the power of this programming language. This time, he’ll add even more fancy tools to the toolkit to help you build a data pipeline in the Google Cloud Platform to join your Google Ads and Google Analytics 4 data together.
I am fortunate to share another guest post by Arben Kqiku, Digital Analyst at Assura. Last time, Arben graced this blog with a comprehensive love letter to R as an example of the power of this programming language. This time, he’ll add even more fancy tools to the toolkit to help you build a data pipeline in the Google Cloud Platform to join your Google Ads and Google Analytics 4 data together.
In a recent update to server-side tagging in Google Tag Manager, Google switched the default deployment of a server-side tagging backend from Google App Engine to Google Cloud Run. Now, when you create a new container and choose the automatically provisioned tagging server option, this service will be created in Google Cloud Run instead of in Google App Engine. While I’ve written about Cloud Run before, this update gives me an opportunity to review what actually happens when you provision a Cloud Run environment, how you can upgrade it, and how you can add enhancements such as multi-region load balancing to it (with ease, I might add!
In a recent update to server-side tagging in Google Tag Manager, Google switched the default deployment of a server-side tagging backend from Google App Engine to Google Cloud Run. Now, when you create a new container and choose the automatically provisioned tagging server option, this service will be created in Google Cloud Run instead of in Google App Engine. While I’ve written about Cloud Run before, this update gives me an opportunity to review what actually happens when you provision a Cloud Run environment, how you can upgrade it, and how you can add enhancements such as multi-region load balancing to it (with ease, I might add!
Google is going all-in with Google Tag. We’ve already seen the consolidation effort through products like Google Analytics 4, and now Google is extending the merging of the tagging stack into Google Tag Manager, too. I’m referring to the new Google Tag that has replaced Google Analytics 4 configuration tags in your Google Tag Manager containers. With this release, all your old GA4 configuration tags have been auto-migrated to the new Google Tag.
Google is going all-in with Google Tag. We’ve already seen the consolidation effort through products like Google Analytics 4, and now Google is extending the merging of the tagging stack into Google Tag Manager, too. I’m referring to the new Google Tag that has replaced Google Analytics 4 configuration tags in your Google Tag Manager containers. With this release, all your old GA4 configuration tags have been auto-migrated to the new Google Tag.
One of the big pain points in configuring Google Analytics 4 through Google Tag Manager has been the difficulty of setting up event parameters, user properties, and settings across a range of tags. Well, we can finally get rid of our clumsy Config tag sequencing hacks because Google has released two new settings variables that mimic how the Google Analytics Settings Variable used to work in Universal Analytics. The new variables are:
One of the big pain points in configuring Google Analytics 4 through Google Tag Manager has been the difficulty of setting up event parameters, user properties, and settings across a range of tags. Well, we can finally get rid of our clumsy Config tag sequencing hacks because Google has released two new settings variables that mimic how the Google Analytics Settings Variable used to work in Universal Analytics. The new variables are:
Today marks the date of exactly 10 years of marriage to my wife, my friend, the loving mother to our children, and my business partner at Simmer. And yes, they are all the same person – I’m that lucky! Thank you, Mari, for everything.
Today marks the date of exactly 10 years of marriage to my wife, my friend, the loving mother to our children, and my business partner at Simmer. And yes, they are all the same person – I’m that lucky! Thank you, Mari, for everything.
Content warning: introspection, parenthood, “Floating Butt”. When Benjamin (our first child) was born, my life as an individual was unraveled. With every bellow from the newborn’s lungs, I could feel my personal agency slipping away from me. From that magical moment onwards, I’ve been gripped by the polarizing emotions of parenthood. At any given time, I’m galvanized by fear for the well-being of my children, or existentially deadlocked by the calamities of all the possible (terrible) futures for this planet, or (figuratively) high from the amazing content and purpose my children bring to my life.
Content warning: introspection, parenthood, “Floating Butt”. When Benjamin (our first child) was born, my life as an individual was unraveled. With every bellow from the newborn’s lungs, I could feel my personal agency slipping away from me. From that magical moment onwards, I’ve been gripped by the polarizing emotions of parenthood. At any given time, I’m galvanized by fear for the well-being of my children, or existentially deadlocked by the calamities of all the possible (terrible) futures for this planet, or (figuratively) high from the amazing content and purpose my children bring to my life.
In January 2020, when Google Tag Manager’s server-side tagging was first introduced to the general public at SuperWeek, I wrote a flurry of tweets, sharing my vision of a server-side tagging future. In one of the tweets, I discussed how you could do these: Hit validation and fixing before the hit is sent to the endpoint PII and privacy controls for the requests before dispatch Fast forward to today, over three years later, and we are finally treated to a feature that grants us scalable controls to properly interrupt data flows within server-side GTM.
In January 2020, when Google Tag Manager’s server-side tagging was first introduced to the general public at SuperWeek, I wrote a flurry of tweets, sharing my vision of a server-side tagging future. In one of the tweets, I discussed how you could do these: Hit validation and fixing before the hit is sent to the endpoint PII and privacy controls for the requests before dispatch Fast forward to today, over three years later, and we are finally treated to a feature that grants us scalable controls to properly interrupt data flows within server-side GTM.
I owe my career to Google Analytics. Whatever success I have achieved over the past 15 years or so can be directly attributed to my work with GA and, by extension, other tools in the Google stack. Now, Universal Analytics is about to be turned down. It fills me with a sense of nostalgia and pining for past, simpler times. When I cast my mind back, a scattering of memories emerges in my mind:
I owe my career to Google Analytics. Whatever success I have achieved over the past 15 years or so can be directly attributed to my work with GA and, by extension, other tools in the Google stack. Now, Universal Analytics is about to be turned down. It fills me with a sense of nostalgia and pining for past, simpler times. When I cast my mind back, a scattering of memories emerges in my mind:
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.
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.
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?
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?
While Measurement Protocol for GA4 is still rather, well, rough, it can be used to augment existing collection quite nicely. Recently, I wrote an article that discussed the nuances of session attribution with Measurement Protocol. One of the pain points of any data ingestion setup is how to debug it. Measurement Protocol hits are not automatically surfaced in GA4’s DebugView. In this article, I’ll show you how to make those hits pop up in the debug stream.
While Measurement Protocol for GA4 is still rather, well, rough, it can be used to augment existing collection quite nicely. Recently, I wrote an article that discussed the nuances of session attribution with Measurement Protocol. One of the pain points of any data ingestion setup is how to debug it. Measurement Protocol hits are not automatically surfaced in GA4’s DebugView. In this article, I’ll show you how to make those hits pop up in the debug stream.
In this article, I’ll try to clarify the understandably murky Measurement Protocol functionality in Google Analytics 4. Measurement Protocol is a way to send events to Google Analytics 4 directly from a machine capable of sending HTTP requests (such as a web server). It’s an alternative collection method to the client-side libraries of Google Tag and the Firebase SDK. Measurement Protocol in GA4 is very different from its predecessor in Universal Analytics.
In this article, I’ll try to clarify the understandably murky Measurement Protocol functionality in Google Analytics 4. Measurement Protocol is a way to send events to Google Analytics 4 directly from a machine capable of sending HTTP requests (such as a web server). It’s an alternative collection method to the client-side libraries of Google Tag and the Firebase SDK. Measurement Protocol in GA4 is very different from its predecessor in Universal Analytics.
This is a guest post by Sebastian Pospischil, Evangelist Digital Analytics at TRKKN. All credit for the solution goes to him. The Summary section is the only one authored by Simo Ahava. You know the deal. Each and every day, clients reach out to you asking for custom click tracking for this call-to-action on that slider, or that button in this section of a page. They reach out to you because such things cannot be answered out of the box in Google Analytics 4.
You can subscribe to this RSS to get more information