GTM and GA4: Consent Initialization exception trigger not working correctly

536 views Asked by At

I am trying to prevent the GA4 tag from loading when the JavaScript variable navigator.globalPrivacyControl is set to true. I am basing my approach off of this tutorial: https://knowandconnect.com/blog/global-privacy-control-gtm/ .

When I preview with GTM, I see that the tag is correctly blocked: GTM Preview Output

Am I interpreting this screenshot correctly, that the tag is blocked?

However, I still see POSTs in the console to GA and can see my location in the real time reports.

I must be missing something foolish.

Here is the variable: globalPrivacyControl variable

This variable is "true" when the Global Privacy Control is on (https://globalprivacycontrol.org/). It is "undefined" if the user has not turned on the Global Privacy Control.

Here is the GA4 tag: GA4 Tag

Here is the Exception Trigger: Exception Trigger

Here is my testing tag to confirm that the GTM variable is set correctly: GPC Test tag

As expected, I get this output from the console when the GPC is on:

globalPrivacyControl GTM: 1

I am implementing this on a clean Google Tag Manager container -- there are no other tags/triggers/variables in this container.

1

There are 1 answers

0
Seth H On BEST ANSWER

After a lot more testing, I figured out the problem is in the "Exception Trigger - Global Privacy Control."

The trigger type had to be "Page view" instead of "Consent Initialization." After making this change the exception started to work correctly and I stopped seeing hits in Google Analytics from GPC-signaled browsers.