Home / Fix guides / Analytics, cookies and GDPR

Facebook Pixel firing before cookie consent: how to check and fix it

If the Facebook (Meta) Pixel loads before a visitor answers your cookie banner, it is tracking without consent, which is usually not allowed for EU and UK visitors. The fix is to stop the Pixel loading until the visitor accepts marketing cookies, then test that it really stays quiet.

The Facebook Pixel (now called the Meta Pixel) is a small piece of code that reports what visitors do on your site to Meta. If it runs the moment a page loads, before the visitor has chosen anything in your cookie banner, it is firing without consent. For visitors in the EU and UK, that is usually not allowed.

What the problem looks like

You may have a cookie banner that looks right, with Accept and Reject buttons. But behind it, the Pixel has already loaded, set its cookie and sent a page view to Meta. If the tracking code ignores the visitor's answer, the banner is only decoration.

Typical signs:

  • A request to facebook.com/tr appears in the browser the moment the page opens, before anything is clicked.
  • A cookie named _fbp is set before any choice is made.
  • Clicking Reject changes nothing: the Pixel still fires.
  • The banner says the site uses cookies but offers only an OK button.

Why it matters

GDPR and the ePrivacy rules generally require opt-in consent before storing or reading non-essential cookies and similar identifiers. Advertising pixels are not essential to running a website. Data protection authorities in several EU countries have taken action against sites that loaded trackers before consent, and small sites are not exempt.

There is also a trust problem. Your banner and privacy policy promise one thing while the site does another, and anyone can check this in two minutes with free browser tools. Data collected from visitors who refused (or were never asked) is data you probably should not hold, and you may be asked to explain it. This is general information, not legal advice. If you are unsure about your obligations, ask a privacy professional.

How to check for free

You only need a browser. The steps below use Chrome, and Firefox and Edge are very similar.

  1. Open your site in a private (Incognito) window so no earlier consent choice is stored.
  2. Open developer tools (press F12, or right-click and choose Inspect) and go to the Network tab.
  3. Reload the page. Do not click anything on the cookie banner.
  4. In the filter box type facebook, then fbevents. Look for fbevents.js from connect.facebook.net and requests to facebook.com/tr.
  5. Open the Application tab (called Storage in Firefox), then Cookies, and look for _fbp.
  6. Clear the cookies, reload, click Reject, and repeat the check.

If any of those appear before you chose Accept, or after you chose Reject, the Pixel is firing without consent. Test more than the home page: product pages, the checkout and pages with forms sometimes load extra tags.

The Meta Pixel Helper browser extension from Meta is also handy, but it mostly shows that a Pixel exists. The Network tab shows when it loaded, which is what matters here. SiteMonday's week 27 GDPR and cookie consent check looks at this area as part of a written report with a ranked fix list.

How to fix it in general

The rule is simple: the Pixel must not load until the visitor accepts the marketing (advertising) category. In practice that means three things.

  1. Find every place the Pixel is installed. It is often in more than one: a theme setting, a Meta or Facebook plugin or app, a snippet pasted in the header, and a Google Tag Manager tag. One forgotten copy is enough to leak.
  2. Use a consent tool that blocks scripts, not just shows a message. This is often called a consent management platform (CMP). If you have no banner at all, start with no cookie banner.
  3. Put the Pixel in the marketing category inside that tool, so it only loads after the visitor accepts that category.

Meta also provides consent controls in the Pixel code itself. You tell the Pixel to wait, then release it when the visitor agrees:

fbq('consent', 'revoke');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
// later, when the visitor accepts marketing cookies:
fbq('consent', 'grant');

This can help, but the Pixel script still loads and contacts Meta. Many privacy advisers consider it safer not to load the script at all until consent is given. Ask whoever advises you on privacy which approach they accept.

Common platforms

Menu names change between versions, themes and plans, so treat these as pointers for where to look.

  • WordPress and WooCommerce: the Pixel usually comes from a theme option, a Meta or Facebook plugin, or code in the header. Use a consent plugin that can block scripts by category and make sure the Pixel is assigned to marketing. Details are in the WordPress guide. On WooCommerce, also check the store's own Meta integration.
  • Shopify: look under Settings for Customer privacy (the name varies) to set up the banner and regions. The Meta sales channel and any code you pasted yourself can behave differently, so test both.
  • Google Tag Manager: set the Meta Pixel tag to fire only when marketing consent is granted, using the tag's consent settings or a trigger linked to your consent tool. See the Google Tag Manager guide.
  • Wix: look for the cookie banner settings and the Facebook Pixel under marketing integrations, and check which cookie category the Pixel belongs to.
  • Squarespace: cookie settings are usually under Settings, Cookies and visitor data. A Pixel added through code injection may not be controlled by the banner, so test it.
  • Webflow: a Pixel pasted into custom code in site settings runs on every page load. You normally need a consent tool that can hold back custom code.

How to confirm the fix worked

Repeat the same test in a fresh private window:

  1. Load the page without clicking anything. You should see no fbevents.js, no facebook.com/tr requests and no _fbp cookie.
  2. Click Reject. Still nothing should appear.
  3. Clear cookies, reload and accept marketing cookies. Now the Pixel should load and events should show up.
  4. Change your choice using the banner's settings link. Rejecting again should stop new Pixel requests.

Check on a phone as well, and on a few different pages. Also confirm Meta's Events Manager still receives events from visitors who accept, so your ads keep working.

How to stop it coming back

This problem tends to return quietly, usually when someone adds a new app, theme or ad campaign.

  • Keep a short list of every tracking tool on the site and who added it.
  • Ask anyone adding a tag or plugin to attach it to a consent category first.
  • Re-run the private window test after theme changes, plugin updates and new marketing setups.
  • Keep your privacy policy in step with what the site really does. See privacy policy outdated if yours has not been reviewed in a while.

A recurring check helps too. SiteMonday runs GDPR and cookie consent in week 27 of its calendar, and each report ends with a ranked list of what to fix. It finds and explains the problem, and fixing it is up to you or your developer.

Step by step for your platform

Questions

Is the Facebook Pixel allowed without consent?

For visitors in the EU and UK it generally is not, because the Pixel sets identifiers and sends data for advertising purposes. Consent is normally needed before it loads. This is general information, so check with a privacy professional for your situation.

Does hiding the Pixel until the banner is clicked break my Facebook ads?

It means you only track visitors who accept, so your numbers will be lower. That is the correct data to have, and ads still work for those visitors.

Is Meta's consent revoke and grant code enough?

It helps, but the Pixel script still loads and contacts Meta. Many advisers prefer to block the script entirely until consent is given.

Why does the Pixel still fire after I clicked Reject?

Usually the banner is not connected to the Pixel. Common causes are a second copy of the Pixel in a theme, plugin or tag manager, or the Pixel set to the wrong cookie category.

How can I tell if my Pixel loads before consent without a developer?

Open a private window, open the Network tab in developer tools, reload without clicking the banner and filter for facebook. Any fbevents.js or facebook.com/tr request means it fired before consent.

Do I need to check this more than once?

Yes. New plugins, themes, apps and ad campaigns can add the Pixel again without anyone noticing, so test after each change.

Related problems