CookieLet integrates natively with Google Tag Manager (GTM) and supports Google Consent Mode v2. Every consent decision made on your banner is automatically communicated to Google tags, so Google services respect visitor choices out of the box.
This guide walks you through deploying the banner via GTM and enabling Consent Mode v2 alongside it. If you haven't already, sign up for CookieLet for free before continuing.
What is Google Consent Mode v2?
Google Consent Mode v2 is Google's framework for aligning tag behaviour with user consent — helping publishers and advertisers collect data in a way that respects privacy regulations such as the GDPR. Instead of tags firing unconditionally, Consent Mode allows them to adapt: when a visitor grants consent, tags operate normally; when consent is denied, tags either stay silent or send cookieless, aggregated signals (depending on whether you use Basic or Advanced Consent Mode).
Implementing Consent Mode v2 through CookieLet is a requirement for serving Google ads to users in the European Economic Area, the UK, and Switzerland.
What's new in Consent Mode v2
Consent Mode v2 introduces two additional parameters on top of the original consent signals:
- ad_user_data — whether the visitor consents to their data being shared with Google's advertising services. When denied, Google advertising tags will not collect or transmit identifiable user data.
- ad_personalization — whether the visitor has opted in to ad personalization and remarketing. When denied, personalized advertising features such as remarketing and interest-based targeting are disabled.
Both parameters are handled automatically by CookieLet from the advertising category on your banner.
Before you begin
- If you have previously installed the CookieLet script in the
<head>of your site, remove it before proceeding with Method 1. Running both installations at once causes the banner to load twice and creates consent-signal conflicts. - New users should not add the CookieLet installation script to the head tag — the GTM tag loads the CookieLet script for you.
- You need a Google Tag Manager container installed on your website.
Step 0: Set up Google Tag Manager (skip if already installed)
- Go to Google Tag Manager and sign in with your Google account.
- Click Create Account, enter an Account Name, and select your Country.
- Enter a Container name (usually your website domain) and select Web as the target platform.
- Click Create and accept the Terms of Service.
- Paste the first snippet as high as possible in the
<head>of every page, and the second snippet immediately after the opening<body>tag. - Publish the container.
How to enable Google Consent Mode v2 in CookieLet
Basic Consent Mode is enabled by default on new accounts. If it has been turned off, re-enable it:
- Log in to your CookieLet dashboard.
- Navigate to Settings > Advanced Settings.
- Toggle on Support Google Consent Mode (GCM) to enable Basic Consent Mode.
- To use Advanced Consent Mode, also toggle on Allow Google tags to fire before consent.
Basic vs. Advanced Consent Mode
- Basic — Google tags load strictly after (and only in accordance with) the visitor's consent decision. No data is sent to Google before consent.
- Advanced — Google tags load before the banner interaction but operate in a restricted, cookieless state. They send anonymous pings that Google uses for behavioural and conversion modelling.
Method 1: Installation using the CookieLet tag in GTM
This is the recommended method. The CookieLet tag inside GTM loads the banner script and pushes consent state updates to Google tags automatically.
Step 1: Get your CookieLet Website Key
- Log in to the CookieLet dashboard.
- Go to Settings > Installation (or click Get Installation Code).
- Select Install with Google Tag Manager.
- Click Copy Key and keep the Website Key handy for Step 4.
Step 2: Create a new tag in GTM
- Open your container in Google Tag Manager.
- Click Tags in the sidebar, then click New.
Step 3: Add the CookieLet template
- Click the Tag Configuration panel.
- Click Discover more tag types in the Community Template Gallery.
- Search for CookieLet CMP.
- Select the template, click Add to workspace, then confirm.
Step 4: Configure the tag
- Paste the Website Key from Step 1 into the Website Key field.
- Review remaining fields (language behaviour, Consent Mode options, etc.) and set them appropriately.
Default Consent Settings (optional but recommended):
- Under Default Consent Settings, click Add Setting.
- For each category, choose Enabled or Denied. For EU/UK, default non-essential categories to Denied.
- In Regions, enter ISO 3166-2 codes (e.g.
DE,US-CA). UseAllfor a global default. Multiple codes can be comma-separated. - Click Add.
Step 5: Set the trigger
- Click the Triggering panel.
- Select Consent Initialization – All Pages.
This trigger is essential — it guarantees the CookieLet tag fires before every other tag, so default consent states are in place before any Google tag evaluates them.
Step 6: Save and publish
- Name the tag (e.g. CookieLet CMP) and click Save.
- Click Submit > Publish to push the change live.
Visit your site in a fresh browser session (or incognito window) to see the banner.
Tip: For third-party marketing or analytics tags deployed via GTM, configure them with GTM's built-in Consent Settings (Advanced Settings > Consent Settings) so they also wait for the consent collected by CookieLet.
Method 2: Installation using the custom script
Use this method if you prefer not to use the GTM template — for example, if you want full control over script ordering, or your GTM setup doesn't allow community templates.
Step 1: Add the default consent script
Paste the following into the <head> of your website, above both the GTM script and the CookieLet 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>wait_for_update: 2000gives CookieLet up to two seconds to load any previously stored consent state before Google tags evaluate their defaults.ads_data_redaction— when true and ad consent is denied, ad click identifiers are redacted from Google network requests.url_passthrough— when true, ad click info (e.g.gclid) is passed through page URLs so conversions can still be measured without cookies.
Step 2: Add the GTM and CookieLet scripts
Add your GTM container snippet and your CookieLet installation script (from CookieLet dashboard > Settings > Installation) to the <head>, respecting the ordering rules below. Place the GTM <noscript> snippet immediately after the opening <body> tag.
Step 3: Confirm the script order
For Advanced Consent Mode:
- Default consent script (from Step 1)
- Google Tag Manager / gtag script
- CookieLet script
For Basic Consent Mode:
- Default consent script (from Step 1)
- CookieLet script
- Google Tag Manager / gtag script
Verify the integration
- Visual check. Open your site in an incognito/private window. The CookieLet banner should appear before any non-essential cookies are set.
- Check GCM status from the CookieLet dashboard. Go to Settings > Advanced Settings and click Check Now next to Check GCM status. A correctly configured site returns "No error detected".
- Verify with GTM Preview mode. In GTM, click Preview, enter your URL, and confirm the CookieLet tag fires on the Consent Initialization event before all other tags — and that the Consent tab shows the correct default and updated states.
- Inspect cookies. In DevTools (Application > Cookies), confirm that advertising and analytics cookies are only written after the corresponding consent is granted.
How CookieLet maps Google consent types
CookieLet maps all seven Google consent types onto its banner's cookie categories:
| Google consent type | CookieLet category | Purpose |
|---|---|---|
ad_storage | Advertisement | Enables storage (such as cookies) related to advertising. |
ad_user_data | Advertisement | Sets consent for sending user data to Google's advertising services. |
ad_personalization | Advertisement | Sets consent for personalized advertising such as remarketing. |
analytics_storage | Analytics | Enables storage related to analytics, such as visit duration and page views. |
functionality_storage | Functional | Enables storage that supports website functionality and settings. |
personalization_storage | Functional | Enables storage related to user personalization, such as content preferences. |
security_storage | Necessary | Enables storage related to security — authentication, fraud prevention, and user protection. These cookies do not require consent. |
Whenever a visitor grants or updates consent, CookieLet pushes a consent update to the data layer with the corresponding "granted" / "denied" values, and Google tags adjust their behaviour immediately.
Troubleshooting & support
- The banner doesn't appear. Confirm the CookieLet tag is published (not just saved) and that its trigger is Consent Initialization – All Pages. Make sure the CookieLet script is not still present in your head tag from a previous installation.
- The banner appears twice. The script is loading from two places — remove the direct head-tag installation and keep only the GTM deployment.
- Google tags fire before consent. Verify every Google tag uses a standard trigger (e.g. All Pages / Initialization), not Consent Initialization, which is reserved for the CMP tag. For Basic Consent Mode, also check the script order.
- GCM status check reports an error. Re-verify that Support GCM is on, the Website Key matches, and the default consent script or Default Consent Settings are present.
Still stuck? Reach out from the CookieLet dashboard or email our support team — we're happy to help you get set up.