❌

Vue normale

Reçu — 10 février 2025 ⏭ Google Tag Manager and Google Analytics on Simo Ahava's blog

#GTMTips: Quickly Duplicate Tags In Google Tag Manager

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.

Cookie Access With Shopify Checkout And SGTM

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. One such case is Shopify’s Checkout Extensibility.

GA4 to Piwik PRO Using Server-side Google Tag Manager

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.

  1. 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.
  2. Piwik PRO -> The tag template works in unison with the Piwik PRO Client, forwarding the hits to the Piwik PRO endpoint. GitHub repo.

Read this article to learn more about how these templates work.

New Piwik PRO Templates In Server-side Google Tag Manager

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.

First-Party Mode For Google Tags

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.

#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. You no longer need to reconfigure the dispatch of important events after consent is granted.

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

The Technical Marketing Handbook By Simmer

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.

Consent Mode V2 For Google Tags

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

I’ve discussed consent mode before, and I’ve also built a Google Tag Manager community gallery template for managing Consent Mode on a website.

Thoughts On Education

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.

Join Google Ads And GA4 Data In Google BigQuery

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.

Goal of this article

My goal for this article is twofold; first, I want to show my fellow R users that it is possible and fun to use R in a production environment! R is sometimes seen as a second-class citizen compared to Python, but in my experience, R has consistently proven effective in addressing all my data challenges at work.

Cloud Run With Server-side Tagging In Google Tag Manager

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

The Google Tag Template In Google Tag Manager

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.

Settings Variables For GA4 In Google Tag Manager

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:

  • Google Tag: Configuration Settings for setting configuration values in the Google Tag template (also a new thing, more on this below). Official documentation.
  • Google Tag: Event Settings for setting event fields in the Google Tag template and in GA4 event tags. Official documentation.

Read on for a quick overview as well as my thoughts about these new additions to Google Tag Manager.

Just Breathe

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.

Transformations In Server-side Google Tag Manager

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.

Dear Google Analytics 4

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:

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

However, there might be cases where you want the server-side GA4 client (which handles the incoming GA4 requests) to occasionally not use the FPID cookie. Perhaps it’s because you have a custom consent system in place, or perhaps you want some GA4 measurement IDs to use the regular JavaScript cookies and others to use the FPID.

❌