Skip to main content

WEBINARNavigating Consent Mode V2: How Should I Prepare?

|

30 April, 2024

3 pm CET (8 am CT)

Register now

Google Consent Mode v2 Integration with CookieYes WordPress Plugin

Last updated on March 15, 2024

The CookieYes WordPress plugin offers built-in support for Google Consent Mode v2, allowing WordPress website owners to integrate this privacy-focused feature from Google seamlessly. Google Consent Mode v2 enhances user privacy by ensuring that Google’s advertising cookies and associated vendor cookies are not read or written until the user consents. This guide provides step-by-step instructions on integrating Google Consent Mode v2 using our WordPress plugin.

If you haven’t already installed CookieYes on your WordPress site, install and setup the CookieYes WordPress Plugin by referring to our, guide.

Google Consent Mode v2 and its New Parameters

Google Consent Mode v2 is the latest iteration of Google’s Consent Mode, designed to help website publishers and advertisers obtain explicit user consent for web tracking activities, ensuring compliance with privacy regulations like GDPR. This updated version introduces standardised consent banners and user preference controls, streamlining the process of obtaining explicit consent from visitors for setting cookies and utilizing web tracking technologies.

Consent Mode v2 allows for the integration of user consent preferences with Google advertising services. Advertisers can generate reports on campaign performance and conversion tracking while respecting user privacy choices. It enables obtaining consent for advertising and analytics cookies in a legally compliant way.

Two key new parameters have been added in Consent Mode v2:

  1. ad_user_data: Reflects the user’s consent for sharing data with Google’s ad services, with values “granted” or “denied” based on the consent banner choice. If denied, Google ads won’t collect identifiable user data.
  2. ad_personalization: Indicates if the user opted-in to ad personalization and remarketing based on consent UI preferences. A “denied” value turns off personalized ad functionality.

How to integrate Google Consent Mode v2 in CookieYes?

Integrating Google Consent Mode v2 is a simple process, whichrequires plugin users to connectto the CookieYes WebApp to enable Google Consent Mode on their website.

Step 1:Enable the Support GCM feature on the CookieYes platform.

By default, this feature should be enabled, but if you have disabled it at any point, follow these steps to re-enable it:

  1. Log in to your CookieYes web app account.
  2. Navigate to CookieYes Dashboard > Advanced Settings.
  3. In Advanced Settings, toggle the button labelled “Support GCM“.
Support GCM
Step2:Integrate GCM v2 Using Custom Consent Mode Script

To integrate Google Consent Mode v2, follow the below steps:

1.Copy the below custom script

<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }
    gtag("consent", "default", {
        ad_storage: "denied",
        ad_user_data: "denied", 
        ad_personalization: "denied",
        analytics_storage: "denied",
        functionality_storage: "denied",
        personalization_storage: "denied",
        security_storage: "granted",
        wait_for_update: 2000,
    });
    gtag("set", "ads_data_redaction", true);
    gtag("set", "url_passthrough", true);
</script>

Note

The values in the code are changeable as per your requirements. e.g.

gtag("set", "ads_data_redaction",false);
 gtag("set", "url_passthrough",false);

2. Add the custom script directly above the wp_head() function in the website header, as shown below.

Step 3:Add the gtag/GTM script.

If your website already has Google Tag Manager installed, ensure that you position the GTM script directly below the Custom Consent Mode Script and above the wp_head() function.

If GTM is not installed on your website, follow the below steps:

  1. Sign Up/ Create a Google Tag Manager Account and set up a container.
  2. Navigate to the Google Tag Manager Dashboard and click on the Container ID in the top navigation Panel.
  3. Copy and paste the GTM script between the custom script and the wp_head() function. Additionally, ensure to insert the <noscript> element immediately after opening the <body> tag.

    GTM Script
Step 4:Ensure the order of the scripts .

Ensure that the scripts are loaded in the following order for proper functionality:

  1. Custom Consent Mode script
  2. gtag / GTM script
  3. CookieYes script

Maintaining this sequence is essential for the correct operation of the functionality.

Note

Do not add CookieYes script again from the CookieYes Webapp. The wp_head() function already executes this action.

Google Consent Type

CookieYes CMP maps all seven Google consent types into 4 categories: 

Google consent typeCookieYes consent typePurpose
ad_storageadvertisementTo enable advertisement cookies.
analytics_storageanalyticsTo enable analytics cookies.
functionality_storagefunctionalTo enable functional cookies for website functionality and settings.
personalization_storagefunctionalTo enable functional cookies for user personalization.
security_storagenecessaryTo enable necessary cookies for website security and protection, user UI preferences, etc. Such cookies do not require consent.
ad_user_dataadvertisementTo enable advertisement cookies to set consent for sending personal data to Google core platform service.
ad_personalizationadvertisementTo enable advertisement cookies to use data for ad personalisation such as remarketing.

Have more questions?

Reach out to us and we'll answer them.

Contact us