Would like to ask for suggestion on how to delete Google Analytics Cookie after user reject approval #628
Unanswered
stanislav-kukucka
asked this question in
Q&A
Replies: 1 comment 2 replies
-
cookies are deleted by the plugin. What you need to do is tell ga4 to stop the tracking (and not recreate the cookies). services: {
ga4: {
label: 'Google Analytics 4',
onAccept: () => {
window.dataLayer = window.dataLayer || [];
window.gtag = function(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
CookieConsent.loadScript('https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX');
},
onReject: () => {
window['ga-disable-G-XXXXXXXXXX'] = true;
},
cookies: [
{
name: /^(_ga|_gid)/
}
]
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here is my link to my config.
Beta Was this translation helpful? Give feedback.
All reactions