Set up CookieFirst to obtain user consent

To capture valuable insights while protecting user privacy, you need to collect consent from your website users. We recommend you use a Consent Management Platform (CMP) or work with your Content Management System (CMS) to collect consent and send it to Google.

Step 1: Set up a consent banner

  1. Sign up for a CookieFirst account.
  2. Configure your banner using the “Getting Started” wizard.
  3. Make sure your banner complies with the requirements in the Google EU User Consent Policy (EUUCP).

For additional information on banner set up, review the CookieFirst implementation guide.

Step 2: Set up consent mode

Set up using Google Tag Manager

  1. Open Google Tag Manager and navigate to your container.
  2. In “Tags”, click New and name your tag.
  3. Click Tag Configuration, then click Discover more tag types in the Community Template Gallery. From the gallery, search for “CookieFirst”, then install “CookieFirst CMP integration (Consent Mode) by CookieFirst.
  4. In the CookieFirst Dashboard, go to “Settings for your domain”, then select Embed Script in the left sidebar. Copy your domain API key.
  5. Navigate back to Tag Manager, then paste your domain API key.
  6. Configure the default settings you would like to use under “Default Consent Mode settings”.
  7. Add a row for global settings, and leave “Regions” blank. You can add additional rows for region-specific settings by using comma-separated ISO 3166-2 country codes in the “Region” box.
  8. Click Add, then click Triggering.
  9. Select “Consent Initialization - All Pages”, then click Save.
  10. Click Preview in the top right corner to test your container. View instructions for testing below.
  11. Publish your container.

Set up using another platform or directly from your website’s code

You can set your Google Consent Mode v2 defaults over the cookie banner. It’s important to make sure your cookie banner embed script is loaded before any Google tags are added at the top of the <head> section of your website. This step is critical to confirm that the CMP functions properly. Learn more about Google Consent Mode v2 without GTM (Manual integration).

  1. Open CookieFirst, then go to the “Domain Settings” page.
  2. Search for the “Google consent mode settings” section.
  3. Toggle the Enable Google Consent Mode switch.
  4. Toggle the Set Google Consent Mode Defaults over cookie banner switch.
  5. In the next section, set the consent mode types based on region. Note: If you’re in the EU and EEA, it’s recommended that you leave the defaults turned off. For users outside of the EU, consult with your legal team to determine the best course of action.
  6. Click Save to finalize your banner configuration settings.

    A screenshot showing Google Consent Mode Settings.

  7. In the CookieFirst Dashboard, go to “Settings for your domain”, then select Embed Script in the left sidebar. Copy the code in the code box under “Content Delivery Network”.
  8. If you use a website builder, review their documentation to learn how to implement code in the “head tag” of each page. 
  9. In the <head> tag of each page (review the instructions above if you use a website builder), paste the following code, followed by the CMP script you copied earlier at the very top of the <head> tag. Note that this step is critical in order to ensure the CMP functions properly.

<script>

// Define dataLayer and the gtag function.

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

function gtag(){dataLayer.push(arguments);}

 

// Set default consent for specific regions according to your requirements

gtag('consent', 'default', {

  'ad_storage': 'denied',

  'ad_user_data': 'denied',

  'ad_personalization': 'denied',

  'analytics_storage': 'denied',

 'regions':[<list of ISO 3166-2 region codes>]

});

// Set default consent for all other regions according to your requirements

gtag('consent', 'default', {

  'ad_storage': 'denied',

  'ad_user_data': 'denied',

  'ad_personalization': 'denied',

  'analytics_storage': 'denied'

});

 

</script>

<!--Banner script here!-->

Testing using Tag Assistant

Learn more about how to Troubleshoot consent mode with Google Tag Manager.

Was this helpful?

How can we improve it?
true
Search
Clear search
Close search
Google apps
Main menu
15611082519368264457
true
Search Help Center
true
true
true
true
true
102259
false
false