Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cookies set before consent (_ga, _fbp): how to find and fix it

TRK-303High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

When someone lands on your site, tags such as Google Analytics 4 and the Meta Pixel can save small files called cookies in their browser. _ga is the Google Analytics visitor ID. _fbp is the Meta browser ID used for ad measurement. If these appear before the visitor has made a choice in your cookie banner, cookies are being set before consent.

Why it costs you leads or sales

How cookies get set too early
  1. Page loadsTags in the head start loading
  2. Tags fire_ga and _fbp written straight away
  3. Banner appearsVisitor has not chosen yet
  4. Visitor choosesToo late: cookies already exist

The tags run before the visitor has answered the banner.

How to check if your site has it

Check for early cookies in your browser
  1. Open a clean session

    Use a private or incognito window, or clear cookies for your domain first. Use an EU or UK location or VPN if your banner depends on region.

  2. Open DevTools before loading

    In Chrome press F12, go to Application, then Storage, then Cookies and select your domain. Keep it open.

  3. Load the page and do not touch the banner

    Look at the cookie list. Names like _ga, _ga_XXXXXXX, _gcl_au, _fbp, _ttp or _uetsid before any choice mean the problem is present.

  4. Check the network tab too

    In Network, filter for collect, facebook.com/tr or googleadservices. Requests sent before you click anything show tags firing early.

  5. Repeat on a second page

    Navigate to another page without answering the banner. Some setups only start tags on the next page view.

Common cookies that should wait for consent
CookieSet byPurpose
_ga, _ga_<ID>Google Analytics 4Visitor and session ID
_gcl_auGoogle Ads / TagAd conversion linking
_fbpMeta PixelBrowser ID for ad measurement
_ttpTikTok PixelBrowser ID for ad measurement
_uetsid, _uetvidMicrosoft (Bing) UETSession and visitor ID

How to fix it

Hold tags until consent
  1. Set the default before tags

    Make sure your consent tool sets a default of denied (analytics_storage, ad_storage, ad_user_data, ad_personalization) on the Consent Initialization trigger, before any other tag.

  2. Turn on consent checks

    In Admin, Container Settings, enable consent overview. Then open each tag, go to Advanced Settings, Consent Settings and require ad_storage or analytics_storage as appropriate.

  3. Fix the triggers

    Move third-party pixels (Meta, TikTok, etc.) off the All Pages trigger onto a trigger that fires only after your consent tool signals acceptance.

  4. Preview and publish

    Use Preview mode, check the Consent tab shows denied on first load, then publish.

Default to denied, update on accept (Google tags)html
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('consent', 'default', {
    ad_storage: 'denied',
    analytics_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied',
    wait_for_update: 500
  });
</script>
<!-- load your Google tag / GTM snippet AFTER the block above -->

<script>
  // call this from your banner's Accept button
  function onAcceptAll() {
    gtag('consent', 'update', {
      ad_storage: 'granted',
      analytics_storage: 'granted',
      ad_user_data: 'granted',
      ad_personalization: 'granted'
    });
  }
</script>
First page load, before any choice

Before

  • _ga and _fbp present in Application, Cookies
  • Requests to facebook.com/tr sent on load
  • Banner is only decoration

After

  • No analytics or ad cookies until Accept
  • Pixel requests start only after consent
  • Tags fire normally once the visitor accepts

How to confirm it's fixed

Test both paths
  1. Test with no choice

    In a fresh private window, load the page and check Application, Cookies. No _ga, _fbp or similar should exist.

  2. Test Reject

    Click Reject and reload. The cookies should still be absent and no pixel requests should appear in Network.

  3. Test Accept

    Click Accept. Cookies should now appear and the GA4 and ad platform requests should fire, including on your thank-you or purchase page.

  4. Check conversions still record

    Submit a test lead as an accepting visitor and confirm the conversion shows in your analytics and ad platform reports.

How to prevent it happening again

Prevention checklist
  • Add every new pixel through one controlled place (tag manager or consent tool), never pasted into theme files
  • Give each new tag a consent requirement before publishing
  • Re-run the clean-browser cookie check after theme, plugin or tag manager changes
  • Re-check after your consent tool updates or you change its categories
  • Keep a list of the cookies your site is allowed to set before consent (strictly necessary only)
  • Test from an EU or UK location as well as your own

How FunnelGuard handles this

Questions people ask

Why is my _ga cookie set before the visitor accepts cookies?

Your Google Analytics tag is loading on page load, not waiting for consent. This happens when the snippet is hard-coded in your theme, or the tag manager trigger fires on All Pages with no consent requirement. Set a denied default and require analytics_storage consent on the tag.

Is the _fbp cookie allowed before consent?

In regions with consent rules, such as the EU and UK, _fbp is a marketing cookie and generally needs prior consent. Block the Meta Pixel until the visitor accepts marketing cookies. Check with your legal adviser for your situation.

How do I check if cookies are set before consent?

Open a private window, open DevTools, go to Application, then Cookies, and load your site without touching the banner. If _ga, _fbp or similar cookies are listed, they were set before consent. Also check the Network tab for tracking requests.

Does Google Consent Mode stop cookies being set?

With analytics_storage and ad_storage set to denied, Google tags do not write their cookies, though they may send cookieless pings depending on your setup. Consent Mode does not control Meta, TikTok or other pixels, so block those separately.

Will blocking cookies until consent hurt my tracking?

You will not record visitors who decline, which is the intended effect. Visitors who accept should still be tracked. Test with Accept to make sure conversions and ad platform events still arrive after the fix.

Why do cookies still appear after I installed a cookie banner?

Most banners only display choices. They do not block scripts unless you set up blocking or consent-aware tags. Scripts pasted straight into the theme or code injection areas ignore the banner and run immediately.

Can FunnelGuard tell me if cookies are set before consent?

Only partly. FunnelGuard captures the cookies on your pages during a journey run, but it has no rule that flags pre-consent cookies. Use the manual clean-browser check to cover that gap.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: cookies captured; no pre-consent cookie rule.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.