I wanted to use the new analytics consent mode which is gdpr compliant following this official guide
Placed following into the header:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXX');
</script>
Analytics consent mode works with:
gtag('consent', 'default', {'ad_storage': 'denied'})
However no longer works (no user activity on dashboard) if I deny cookies in the settings like so:
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
My understanding is that it should still reflect page hits without the cookie.
I can see the POST request being sent to their go server with status 204.
What am I doing wrong?
The hits with 'analytics_storage'
set to 'denied'
are not shown in GA reports at all now.
Initially I could see them in the real-time report, but now that seems to be gone too.
Having said that, it is possible to manipulate the request with the customTask API and rewrite the 'gcs' parameter (or drop it altogether). This way, you would see the anonymized (on user level) hits in GA while not using cookies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With