Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs]: how to configure google consent mode #669

Open
orestbida opened this issue Apr 1, 2024 · 11 comments · May be fixed by #751
Open

[Docs]: how to configure google consent mode #669

orestbida opened this issue Apr 1, 2024 · 11 comments · May be fixed by #751
Labels
documentation Improvements or additions to documentation

Comments

@orestbida
Copy link
Owner

orestbida commented Apr 1, 2024

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

@orestbida orestbida added the documentation Improvements or additions to documentation label Apr 1, 2024
@github-actions github-actions bot added the triage yet to be reviewed label Apr 1, 2024
@orestbida orestbida removed the triage yet to be reviewed label Apr 1, 2024
@H0nzik1
Copy link

H0nzik1 commented Apr 3, 2024

how to do it please?

@jannejava
Copy link

I assume this is the way forward, or? #665 (comment)

@Charissa24
Copy link

how to do it please?

This article explains how to implement consent mode with v2.9.

@jannejava
Copy link

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?

@Hucoo
Copy link

Hucoo commented May 15, 2024

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),

@amitsarkerr
Copy link

@Hucoo Are you using v3?

@Hucoo
Copy link

Hucoo commented May 16, 2024

@Hucoo Are you using v3?

What you mean about v3?

@amitsarkerr
Copy link

amitsarkerr commented May 16, 2024

@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?

@Charissa24
Copy link

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/

@alxndr-w
Copy link

@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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants