Reputation: 3034
Using GA4 property with (gtag.js
) following config:
gtag('js', new Date());
gtag('config', 'G-XXXXXXX', {
client_storage: 'none',
client_id: clientId, // I generate this
anonymize_ip: true,
});
And it still writes _ga
and _ga_XXXXXXX
cookies.
From what I found the flag client_storage=none
only works for the old UA-
properties, but for the new G-
properties it doesn't have any effect.
Upvotes: 8
Views: 5803
Reputation: 210
It doesnt work, and there are several reasons for it. Google says, that nothing comes through if consent it denied. I uses an AI to emulate traffic though. But certain requirements has to be met:
Because the model is trained on the observed data for your Google Analytics 4 property, your property must have enough data to train the model. To be eligible for behavioral modeling, your property must meet the following criteria:
Consent mode is enabled across all pages of your sites and/or all app screens of your apps.
Consent mode for web pages must be implemented so that tags are loaded before the consent dialog appears, and Google tags load in all cases, not only if the user consents (advanced implementation).
The property collects at least 1,000 events per day with analytics_storage='denied' for at least 7 days.
The property has at least 1,000 daily users sending events with analytics_storage='granted' for at least 7 of the previous 28 days.
It may take more than 7 days of meeting the data threshold within those 28 days to train the model successfully; however it's possible that even the additional data won't be sufficient for Analytics to train the model.
https://support.google.com/analytics/answer/11161109
The only way for it to work, is to set the cookie for some users, and let the AI emulate traffic. The cookie is a first party cookie, so it's not a big problem.
Upvotes: 0
Reputation: 21
I have a react project and I call
ReactGA.gtag('consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied',
functionality_storage: 'denied',
personalization_storage: 'denied',
security_storage: 'granted',
wait_for_update: 2000,
})
before the ReactGA.initialize
method and it seems there are no cookies in the developer console. I don't see much into this. More context here
EDIT: Even tho the setting remove the cookies, it turned out the GA stopped tracking, so basically nothing worked.. :/
Upvotes: 1
Reputation: 14189
The new G-
properties it always has the data anonymized by default, so there is no need for the parameter anonymize_ip
.
Anonymization tends to be used to assimilate the data from statistical to technical and to be able to track with Google Analytics.
Blocking tracking is not a good practice, inconsistent and unrepresentative data can be collected based on when the user accepts the cookie policy.
That kind of configuration (client_secure) works in UA while in GA4 doesn't work (at least currently). It is still an evolving system.
Upvotes: 0