cookieconsent
cookieconsent copied to clipboard
[Docs]: how to configure google consent mode
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? https://github.com/orestbida/cookieconsent/issues/665#issuecomment-2022621032
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?
@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/
@Charissa24 is this tutorial written by yourself?
I tried to understand it but I don't get the steps needed, maybe because there seem to be many possibilities to use and configure Tag Manager.
https://github.com/brainsum/cookieconsent?tab=readme-ov-file#consent-mode-v2 and https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced&hl=de#region-specific-behavior just suggest to set gtag()
parameters which seem to make it much more easy: It doesn't require me to go through the Google Tag Manager Container's GUI, am I right?
@Charissa24 is this tutorial written by yourself?
I tried to understand it but I don't get the steps needed, maybe because there seem to be many possibilities to use and configure Tag Manager.
https://github.com/brainsum/cookieconsent?tab=readme-ov-file#consent-mode-v2 and https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced&hl=de#region-specific-behavior just suggest to set
gtag()
parameters which seem to make it much more easy: It doesn't require me to go through the Google Tag Manager Container's GUI, am I right?
I didn't write this tutorial. But it should all be done within Tag Manager.