Hi @quent1000
Thanks for using our plugins.
We spent about 2hrs to find a solution to this 🙂
It’s true, the GA4 cookies can’t be deleted. Our plugin removes the cookies on reject, but the GA script and function is still there, it will re-create the cookies before we reload the page. So to fix this, we would suggest going with Google Consent setup:
https://support.mooveagency.com/topic/google-tag-manager-integration/
The GA script should be hardcoded to head section:
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Default ad_storage to 'denied'.
gtag('consent', 'default', {
'ad_storage': 'denied'
});
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
and only the following script should be added to our plugin:
<script>
gtag('consent', 'update', {
'ad_storage': 'granted'
});
</script>
Hope this helps.
Thanks
Sorry for my late answer.
Thank you for your quick answer, your solution works perfectly. I just added the analytics_storage tag to prevent the sending of statistical data if the user refuses it.
'analytics_storage': 'denied'
I will recommend the use of your plugin for future projects.
Thanks again.
Hi @quent1000
Glad to hear it’s all working for you now!
If you have time, we would highly appreciate if you could help us and rated our plugin with 5 stars in the WordPress.org repository so other users can find it too:
https://wordpress.org/support/plugin/gdpr-cookie-compliance/reviews/?rate=5#new-post
Many thanks