GA4 Tip: GA4 Configuration tag in Google Tag Manager

Chris Vu
Sparkline
Published in
2 min readApr 10, 2023

--

Photo by Cookie the Pom on Unsplash

In Google Tag Manager (GTM), you can consolidate settings and variable values in one place so that you can easily use them in multiple Google Analytics tags:

  • For Universal Analytics (UA), you use the Google Analytics Settings GTM variable
  • For Google Analytics 4 (GA4), you use the GA4 Configuration GTM tag

However, the way they function are very different.

UA Settings

It is a GTM variable. Which means it does nothing by itself, it is to be read by UA tags.

The values in the UA Settings variable are updated dynamically in all GTM events. This makes it an ideal place to consolidate commonly used UA settings and values.

GA4 Configuration

It is a GTM tag. Which means it is to be fired on a GTM event (eg. Container Loaded). Additionally, the settings and values can be read by GA4 Event tags.

A big gotcha here is that when the GA4 Configuration tag is loaded, the settings and values become fixed at the point of the triggering GTM event. They are NOT updated dynamically in subsequent GTM events.

This can caused loading order issue such as this example:

  1. GA4 Configuration tag is loaded on Container Loaded GTM event. A data layer variable (eg. member_type) can be undefined at this point.
  2. The data layer variable member_type is then populated asynchronously by the web server (eg. member_type = “vip”).
  3. GA4 page_view event is then fired on DOM Ready GTM event, reading the GA4 Configuration tag. But this event will record the member_type as undefined!

At the time of this writing, there are no elegant ways to resolve issues like this. One solution is to repeat the GA4 parameters in EACH of your GA4 Event tags. But this kind of defeats the purpose of consolidating the settings and value into one place.

Please, Google, give us a proper GA4 “Settings” variable in GTM.

Photo by Matthew Henry on Unsplash

Sparkline aims to provide data accuracy, comprehension and consolidation, and most importantly, tangible insights for businesses. Get in touch if you’d like to find out more about GA4.

--

--

Chris Vu
Sparkline

How did my life bring me to this point being a technical consultant in digital analytics and optimization, I have no idea…