Skip to main content

Implementing Google Consent Mode Using CookieYes

Last updated on July 21, 2023

CookieYes now supports Google’s Consent Mode. Consent Mode is an API developed by Google to integrate Google tag behaviour and the user’s consent tool. The Consent Mode has five consent types for cookies, such as advertisement, analytics, functional, personalization and security, for using the global site tag or Google Tag Manager (GTM). You can use them to decide how the tags behave based on user consent. E.g. if a user denies consent to use analytics cookies, the website will not use the cookies and instead send an aggregate level of analytics information. Thus, the Consent Mode bridges the gap between respecting user consent and measuring conversions.

Here is a guide to how to integrate CookieYes with the Consent Mode.

If you don’t have an account with CookieYes, sign up for free and get started.

How to enable Google Consent Mode in CookieYes?

The first and most important step in implementation is to enable the Google Consent Mode feature on the CookieYes platform. To enable this, follow the below steps:

  1. Log in to your CookieYes web app account.
  2. Navigate to CookieYes Dashboard > Site Settings.
  3. In Site Settings, toggle the button (to the right) labelled “Support GCM“.

CookieYes Consent Mode integration

If you use Consent Mode with CookieYes, every time the website users give their consent choice, CookieYes will signal Google to modify the tag behaviour based on the user’s choice. Therefore, the website will stop collecting or using any personally identifiable information and use aggregated information for its services. 

There are two methods to integrate Consent Mode with CookieYes — with and without using Google Tag Manager Template.

For CookieYes plugin users, only Method 2 is applicable.

Method 1: Implementation using Google Tag Manager template

First, you need to set up Google Tag Manager for your website. You can refer to the help guide for detailed instructions.

You need not add the CookieYes script to the head tag of your website code if you are using Google Consent Mode with our Google Tag Manager template.

Now, follow these steps:

Step 1. First, you need to create a new tag. Click Tags in the left sidebar, and then New as shown.

Add a new tag on google tag manager for consent mode

Step 2. Click on Tag Configuration > Discover more tag types in the Community Template Gallery and search for CookieYes CMP. Alternatively, you can get the template from here and skip to step 3.

click tag configuration to add a new tag on google tag manager for consent mode
choose tag type

Step 3. Choose the CookieYes template and click Add to workspace Add to add the tag.

add cookieyes template to tag manager workspace

Step 4. Insert the CookieYes website key, set other fields to appropriate values, and save the tag after naming it.

add tag

Log into your CookieYes account and go to Site Settings, then


Get Installation Code > Copy Code.


Copy the website key from the src attribute (e.g. src=””).

To add Default Consent Setting:

  1. Click Add Setting.
  2. Set the region by entering the region’s ISO 3166-2 code, and enter the appropriate value for cookie categories.
  3. Click Add.
add default consent setting

You can add multiple regions by entering the comma-separated region codes.

Step 5. Select Consent Initialization – All Pages as the trigger for the tag.

add trigger
Select consent initialization as the trigger to fire the CY tag

Step 6. Click Save to complete the integration of CookieYes with the Google Consent Mode.

CY tag added to Google tag manager

Method 2: Implementation using the custom script

To integrate CookieYes with Consent Mode without the use of CookieYes GTM template:

Step 1. Copy the custom script:


    window.dataLayer = window.dataLayer || [];

    function gtag() {



    gtag("consent", "default", {

        ad_storage: "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);


Step 2. Paste the custom script above the CookieYes script and Google Tag Manager script. Ensure that the order of the scripts is as follows:

  • Custom Consent Mode script
  • gtag / GTM script
  • CookieYes script

The script must be loaded in this order for it to work.

CookieYes Plugin user need not add CookieYes script again.

CookieYes CMP maps all five 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.


Have more questions?

Reach out to us and we'll answer them.

Contact us