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:
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.
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 Exception Trigger:
Here is my testing tag to confirm that the GTM variable is set correctly:
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.
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.