How to Fix a Missing Cookie Consent Banner for Tracking Tags

Your site loads analytics or advertising tags (Google Analytics 4, Google Tag Manager or the Meta Pixel), but no cookie-consent tool was detected. By the end of this guide you will have a consent management platform (CMP) installed, your tags will wait for opt-in, Google Consent Mode v2 will be configured, and you will have confirmed that nothing tracks before a visitor agrees.

By Updated ⏱ 45-90 minutes🎯 Intermediate● Medium impactTechnical
Illustration: Cookie consent banner fix guide
TECHNICAL · FIX GUIDE Cookie consent banner IMPACTEFFORT TIME45-90 minutes LEVELIntermediate

Why it matters

Under GDPR and the ePrivacy Directive, non-essential cookies and similar identifiers need prior consent from visitors in the EU, EEA and UK. Regulators such as the CNIL and the ICO have fined sites for loading trackers before consent or for hiding the Reject option. Since March 2024, Google requires Consent Mode v2 signals for EEA traffic.

Without them, remarketing audiences and conversion modelling in Google Ads and GA4 stop working for those users. A clear banner with an equal Reject option also builds trust, and the opt-in data you do collect is lawful to use.

✕Beforeexample.com loads gtag.js(G-ABC123XYZ) and the Meta Pixel onfirst page view. _ga and _fbp cookies✓Afterexample.com shows a CMP banner withequal Accept and Reject buttons.Consent Mode defaults are 'denied',

What you need

Admin access to your site's theme, CMS or code (to edit the <head>)
Access to your Google Tag Manager container and/or GA4 property
An account with a CMP (e.g. Cookiebot, Usercentrics, CookieYes, OneTrust, Complianz or iubenda)
A list of the tracking tags and cookies your site uses

Step-by-step fix

1

Inventory every tracking tag on the site

Open example.com in a private window and view the page source. Search for these markers:

  • gtag/js?id=G- for GA4
  • googletagmanager.com/gtm.js?id=GTM- for Google Tag Manager
  • fbq('init' or connect.facebook.net for the Meta Pixel

Also check the tags inside your GTM container (Tags list) and any plugin or app that injects tracking. Write down each tag, its ID and its purpose (analytics or marketing).

Pro tip: In Chrome DevTools, go to Application > Cookies before you click anything. Every non-essential cookie you see there (_ga, _gid, _fbp, _gcl_au) is currently being set without consent.
2

Choose a CMP that supports Consent Mode v2

Pick a consent management platform that does three things: blocks scripts before consent, sends Google Consent Mode v2 signals, and is on Google's list of certified CMPs if you run Google Ads or AdSense in the EEA/UK. If you sell programmatic ad inventory, also require IAB TCF v2.2 support. Create an account, add example.com as a domain, and run the CMP's cookie scan so it can sort the cookies into Necessary, Preferences, Statistics and Marketing.

Pro tip: Check the CMP's pricing tier against your monthly pageviews or subpage count. Free tiers often cap domains or pages, and the banner can stop showing when you exceed the cap.
3

Load the CMP script first in the <head>

Paste the CMP snippet as the very first script in the <head> of every page, above GTM, gtag.js and the Meta Pixel. The banner can only block tags that load after it. The example below uses Cookiebot's auto-blocking mode; other CMPs provide an equivalent snippet in their dashboard under Installation or Implementation.

html
<head>
  <!-- 1. Consent tool first -->
  <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" data-blockingmode="auto" type="text/javascript"></script>
  <!-- 2. Then GTM / gtag.js / Meta Pixel -->
</head>
Pro tip: If your CMP offers a GTM template (Templates > Search Gallery in GTM), you can deploy it through GTM instead. Fire it on the 'Consent Initialization - All Pages' trigger, not 'All Pages'.
4

Set Google Consent Mode v2 defaults to denied

Before any Google tag loads, declare default consent states so GA4 and Google Ads stay cookieless until the visitor opts in. Many CMPs inject this automatically; check your CMP settings for a 'Google Consent Mode' toggle. If yours does not, add the snippet below directly after the CMP script.

})` with 'granted' values when the visitor accepts.

html
<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: 500
  });
</script>
Pro tip: You can scope stricter defaults to specific regions with the `region` parameter (e.g. region: ['AT','BE','DE','FR','GB',...]). Keep a global 'denied' default if you are unsure where visitors come from.
5

Gate non-Google tags on consent in GTM

In GTM, go to Admin > Container Settings and tick Enable consent overview. Then open Tags, click the shield icon, and set each tag's Additional Consent Checks.

  • Meta Pixel and other ad tags: require ad_storage
  • Hotjar, Clarity and similar analytics: require analytics_storage

If the Meta Pixel is hard-coded rather than in GTM, revoke consent before init and have your CMP's accept callback grant it.

html
<script>
  fbq('consent', 'revoke');
  fbq('init', '000000000000000');
  fbq('track', 'PageView');
  // In your CMP's 'marketing accepted' callback:
  // fbq('consent', 'grant');
</script>
Pro tip: Google tags (GA4, Google Ads) have built-in consent checks and adapt to Consent Mode automatically. Third-party tags do not, so they always need explicit consent checks.
6

Configure the banner to meet consent rules

In your CMP dashboard, set the banner up so that:

  • Accept all and Reject all sit on the first layer with equal size and prominence
  • No category except Necessary is pre-ticked
  • The banner links to your cookie policy at example.com/cookie-policy
  • A persistent 'Cookie settings' link (usually in the footer) lets visitors withdraw consent as easily as they gave it

Publish the configuration and clear any page or CDN cache.

html
<a href="#" onclick="Cookiebot.renew(); return false;">Cookie settings</a>
Pro tip: If you geo-target the banner to EU/UK visitors only, make sure the CMP script still loads globally. Tools that test from outside the EU then still detect it.
7

Test consent behaviour and re-run the audit

Open example.com in a fresh private window, then check each of the following:

  • Before clicking: DevTools > Application > Cookies should show no _ga, _gid, _fbp or _gcl_au cookies.
  • After Reject: reload and confirm the same cookies are still absent.
  • After Accept: they should appear. In the Network tab, requests to google-analytics.com/g/collect should carry gcs=G111 after Accept and gcs=G100 before it.

Finally, re-run the audit to confirm a consent tool is now detected.

javascript
// Run in the DevTools console
window.google_tag_data && google_tag_data.ics && google_tag_data.ics.entries
Pro tip: Google Tag Assistant (tagassistant.google.com) has a Consent tab that shows the default and updated state for every Google tag on each event.

Platform-specific notes

WordPress

Install a CMP plugin such as Complianz, CookieYes or the official Cookiebot plugin. Prefer one that supports the WP Consent API so plugins like Site Kit respect consent. If GA4 is added via Site Kit, enable Consent Mode under Site Kit > Settings > Admin Settings. Clear caching plugins (WP Rocket, LiteSpeed) after setup.

Shopify

Go to Settings > Customer privacy > Cookie banner to enable Shopify's built-in banner, which uses the Customer Privacy API. Alternatively, use a Shopify-integrated CMP app. Tags added through the Google & YouTube app and the Facebook & Instagram app honour this consent. Custom pixels in Settings > Customer events need their permission set to 'Required' for marketing or analytics.

Wix

Turn on the built-in banner in Dashboard > Settings > Privacy & Cookies > Cookie banner. Custom code added under Settings > Custom code must be assigned a cookie category (Essential, Functional, Analytics or Advertising) so Wix blocks it until consent. Wix integrations for GA4 and the Meta Pixel are gated automatically.

Webflow

Paste your CMP snippet at the top of Site settings > Custom code > Head code and republish. A common free option is Finsweet Cookie Consent, which blocks scripts you change from type="text/javascript" to type="fs-cc" with an fs-cc-categories attribute. Any GA4 ID entered in Site settings > Apps & integrations bypasses this, so move it into GTM or the custom code instead.

Next.js

In the App Router, load the CMP in app/layout.tsx with next/script and strategy="beforeInteractive". Render the Consent Mode defaults inline before @next/third-parties' GoogleTagManager or GoogleAnalytics components. Do not rely on a React-rendered banner alone: it mounts after hydration, so tags in the <head> can fire before it appears.

Check that it worked

✅ How to verify

  • In a private window, DevTools > Application > Cookies shows no _ga, _gid, _fbp or _gcl_au cookies before you interact with the banner, or after you click Reject.
  • Google Tag Assistant's Consent tab shows the default states as 'denied' and the updated states as 'granted' only after Accept.
  • The banner is visible on first load of the homepage and of an inner page. The CMP global (e.g. window.Cookiebot, window.__tcfapi or window.UC_UI) exists in the console.
  • Re-running the site audit reports that consent management was found.

⚠️ Common mistakes

  • Adding a cosmetic banner (a custom 'We use cookies' bar) that does not actually block GA4, GTM or the Meta Pixel, so tracking still fires on page load.
  • Placing the CMP script below GTM or gtag.js, so tags execute before the consent default is set.
  • Hiding Reject behind a 'Settings' layer or pre-ticking Statistics and Marketing. EU regulators consider neither valid consent.
  • Loading the CMP only for EU IP addresses at server level, which means crawlers, audits and VPN users never see it, and EU visitors are missed when geolocation fails.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Do I need a cookie banner if I only use Google Analytics 4?

Yes, for visitors in the EU, EEA and UK. GA4 sets _ga cookies and sends identifiers that are not strictly necessary, so ePrivacy rules require prior consent. Consent Mode lets GA4 send cookieless pings while consent is denied, but you still need a banner to collect the opt-in.

Is Google Consent Mode v2 the same as a cookie banner?

No. Consent Mode is a signalling API that tells Google tags how to behave. It does not display anything or record consent. You still need a CMP to show the banner, store the visitor's choice and send the 'update' command.

Do I need a banner if my site has no visitors from Europe?

Not under GDPR. However, US state laws (California CCPA/CPRA, Colorado, Connecticut and others) require opt-out mechanisms such as 'Do Not Sell or Share' links and honouring Global Privacy Control signals. Most CMPs can show a different banner per region.

Can I avoid a consent banner by using cookieless analytics?

Often, yes. Privacy-focused tools that set no cookies and store no personal data, such as self-hosted Matomo in cookieless mode, Plausible or Fathom, are generally treated as exempt in many EU countries. Your audit only requires a consent tool when GA4, GTM or the Meta Pixel are present. Removing those tags and switching to a cookieless tool also resolves the warning.