[Docs]: how to configure google consent mode
orestbida opened this issue · comments
What is the improvement/update you wish to see?
Add a section in the docs on how to configure google consent mode (v2). (#665)
Link the related docs page, if it exists.
No response
how to do it please?
I assume this is the way forward, or? #665 (comment)
how to do it please?
This article explains how to implement consent mode with v2.9.
how to do it please?
This article explains how to implement consent mode with v2.9.
Interesting, this seems to be another way. It seems that you can configure cookie consent without touching the site's code, instead using Google Tag Manager, or is this the way?
I do it this way
function updatePreferences(cookie) {
let preferences = {
analytics_storage: "denied",
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied"
};
cookie.categories.forEach(category => {
if (category === 'analytics') {
preferences.analytics_storage = "granted";
}
if (category === 'advertising') {
preferences.ad_storage = "granted";
preferences.ad_user_data = "granted";
preferences.ad_personalization = "granted";
}
});
if (preferences) {
window.dataLayer = window.dataLayer || [];
function gtag() {
window.dataLayer.push(arguments);
}
gtag("consent", "update", preferences);
setTimeout(function () {
window.location.reload();
}, 1000);
}
}
onFirstConsent: ({cookie}) => updatePreferences(cookie),
onChange: ({cookie}) => updatePreferences(cookie),
@Hucoo Are you using v3?
@Hucoo Are you using v3?
What you mean about v3?
Have you found a solution for cookie consent version 3 to ensure compatibility with Google Consent?
Hi everyone, there's an updated tutorial for version 3:
https://uninterrupted.tech/blog/manage-user-cookie-consent-with-google-tag-manager-adapting-to-cookie-consent-v3/