Is your GA4 data actually right? We find what's broken and fix it, at a fixed price. Get it fixed
noxtag
Consent

Cookies loading before consent: how to find and fix it

In short
  • If _fbp, _gcl_au or _ttp exist before anyone clicks the banner, a tag is firing without waiting for consent.
  • Google tags need Consent Mode defaults set to denied. Every other tag needs an additional consent check in GTM, or blocking by your consent tool.
  • Hard-coded pixels in the theme and Shopify apps bypass GTM entirely, so check them separately.
  • Test in a fresh private window from an EU location, before and after clicking Reject.

You open your site in a private window, don't touch the cookie banner, and the browser already holds _fbp, _gcl_au and _ttp. That means advertising tags are running before the visitor has made a choice. In the EU and UK, non-essential cookies need consent first, so clicking "Reject" on that banner doesn't do what visitors think it does.

This is the most common problem we find in tracking audits. The good news is that it usually comes down to a handful of tags, and each one has a clear fix.

How to check your own site

  1. Open a private window, so there are no cookies from earlier visits.
  2. Go to your site and don't click the banner.
  3. Open DevTools (F12 or Cmd+Option+I) → Application → Cookies → your domain.
  4. Look for advertising cookies: _fbp (Meta), _gcl_au (Google Ads), _ttp (TikTok), _uetsid / _uetvid (Microsoft Ads), _pin_unauth (Pinterest), _rdt_uuid (Reddit), _scid (Snap), li_fat_id (LinkedIn).

If any of them are there, something is firing too early. Our free cookies before consent checker does the same test from a fresh browser and lists each cookie with the tag that set it.

Many consent tools only show the banner, and only block tags, in the regions you configure. If you're outside the EU, test with a VPN set to an EU country too, or you may be testing the wrong rules.

Free download · PDF

The 40-point GA4 audit worksheet

Every check in a printable worksheet, with where to look in GA4 and a priority for each one.

You'll also get the noxtag newsletter: one practical tracking fix every two weeks. Unsubscribe anytime.

Why it happens

There are five usual causes, often more than one on the same site:

  • Tags in Google Tag Manager with no consent check. Google's own tags respect Consent Mode automatically. Meta, TikTok, Pinterest, LinkedIn and the rest don't, so they fire on page load unless you tell them to wait.
  • Consent Mode defaults missing or set to granted. Without a denied default, Google tags store cookies straight away.
  • Pixels hard-coded in the theme. A <script> pasted into the site's header runs before GTM or your consent tool can stop it.
  • Apps and plugins that add their own tracking. Shopify apps, WordPress plugins and marketing tools often inject pixels themselves, outside GTM.
  • A consent tool that loads too late or blocks nothing. If the consent tool's script loads after the tags, or its automatic blocking is switched off, it only displays a banner.

The fix, step by step

Start from the cookie list (the checker gives it to you) and match each cookie to its tag. Then look for that tag in three places: your GTM container, your site's theme or template code, and your platform's apps or integrations. Write down where each one lives, because the fix depends on it.

In GTM, your consent tool's template (or a consent default tag) must fire on the Consent Initialization – All Pages trigger and set all four Google signals, ad_storage, analytics_storage, ad_user_data and ad_personalization, to denied for the EU, EEA and UK. Your consent tool then sends an update when the visitor chooses. The Consent Mode v2 guide covers this setup in detail.

This stops Google tags from setting cookies before consent. It does nothing for other vendors' tags.

  1. In GTM go to Admin → Container settings and tick Enable consent overview.
  2. On the Tags page, click the shield icon to open the consent overview. It lists every tag that has no consent settings.
  3. For each advertising tag (Meta, TikTok, Pinterest, LinkedIn, Microsoft, Reddit, Snap, Criteo…), open Advanced Settings → Consent Settings → Require additional consent for tag to fire and add ad_storage.
  4. For analytics or session-recording tools such as Microsoft Clarity or Hotjar, require analytics_storage.
  5. Publish, then check in GTM Preview: on a fresh load before consent, those tags should show as Not Fired. After you accept, they should fire.

With a consent check, GTM holds the tag back until consent is granted, then fires it on the next matching trigger. You don't need a separate "consent given" trigger for most setups.

4. Move or wrap hard-coded pixels

Pixels pasted into theme code can't be controlled by GTM. You have two options:

  • Move them into GTM (best), using the vendor's GTM template, and remove the theme code.
  • Let your consent tool block them. Most consent tools block a script when you change its type and tag it with a category, for example type="text/plain" data-cookieconsent="marketing" for Cookiebot, or type="text/plain" class="optanon-category-C0004" for OneTrust's targeting category. The script then only runs after consent for that category.

5. Deal with apps and plugins

  • Shopify: check Settings → Customer events. App pixels and custom pixels running there follow Shopify's customer privacy settings, so connect your consent tool to Shopify's Customer Privacy API (most consent apps do this) and check each custom pixel's permission setting. Pixels injected through the theme or an old app embed bypass all of this, so look for them in the theme code too. Our GTM on Shopify guide explains how the pieces fit.
  • WordPress: marketing plugins often add their own pixel. Turn off the plugin's pixel and fire it from GTM instead, or use a consent plugin that integrates with it.
  • Make sure its script loads first, before GTM and before any pixel.
  • Check the regions where it shows the banner and blocks tags.
  • If it has automatic blocking (Cookiebot and OneTrust both do), test it carefully before relying on it: it can block scripts your site needs, and it doesn't replace correct consent settings in GTM.

How to test the fix

Run each of these tests from a fresh private window, ideally from an EU location:

  1. Before any click: no advertising cookies, and in DevTools → Network no requests to facebook.com/tr, analytics.tiktok.com or similar.
  2. Click Reject: still no advertising cookies, even after you browse a few pages.
  3. Click Accept: the cookies appear and the tags fire. If they don't, the consent update isn't reaching GTM.
  4. Check Google tags: a GA4 request before consent should carry gcs=G100 and a gcd value showing the defaults as denied. Paste one into the Consent Mode decoder to read it.

Then run the cookies before consent checker again: it should report zero advertising cookies.

Is your GA4 & GTM setup collecting the right data?

We find what's broken in your tags, data layer and consent setup, then fix it for you, not just list it. An AI agent keeps watch afterwards so it stays fixed.

Fixed price · Nothing changes without your OK · Reply within 1 business day

Common mistakes

  • Fixing GTM and forgetting the theme. The cookie is still there because the pixel was never in GTM.
  • Setting Consent Mode and assuming it covers everything. It only controls Google's tags.
  • Testing from outside the EU while the banner only applies to EU visitors.
  • Firing tags on the consent event only. It works for the first page, but if the consent state isn't read on later pages, tags never fire again. Consent checks on the tag handle this for you.
  • Blocking everything with no update. If consent is never updated after Accept, you lose all marketing data from people who agreed.

Frequently asked questions

Strictly necessary cookies can: session, cart, security, load balancing and the cookie that stores the visitor's consent choice. Advertising, analytics without Consent Mode, and social media cookies need consent first in the EU and UK.

No. Consent Mode only changes how Google's own tags behave. Other vendors' tags need an additional consent check in GTM, or blocking by your consent tool.

Why does my site pass the test in one country and fail in another?

Most consent tools apply different rules by region. Outside the EU the banner may not appear at all, and tags fire straight away, which may be allowed there. Test from each region you care about.

You lose data from visitors who decline, which is the point of asking. Consent Mode's modelling in GA4 and Google Ads recovers part of it for Google, and correct consent updates make sure you keep everything from visitors who agree.

Want it fixed for you?

We find every tag that fires too early, fix it in GTM, your consent tool and your platform, and test it from the regions that matter. Our agent then checks your site every day, so a new app or theme update can't quietly break it again. See how it works.

noxtag is a small, senior tracking-implementation practice. We write these guides from real GA4 and GTM audits. More about us.

One tracking fix every two weeks

Short, practical GA4 and GTM fixes from real audits. No fluff, unsubscribe anytime.

We store your email only to send the newsletter. See our privacy policy.