Skip to content

Meta Pixel fires before consent on WooCommerce: find it and fix it

How to check whether your WooCommerce shop sends Meta Pixel data before visitors accept cookies, why it happens, and how to fix it step by step.

Lukas Kontur · · 8 min read

You installed a cookie banner, you connected your shop to Facebook and Instagram ads, and everything looks fine in the admin. Then a scan (or a customer) tells you that the Meta Pixel is already running before anyone clicks "Accept". This guide shows you how to check that yourself in five minutes, why it happens on WooCommerce shops, and how to fix it without breaking your ad tracking for visitors who do accept.

The symptoms

You are probably dealing with this problem if one of these is true:

  • A scan report lists a marketing cookie set before consent, usually _fbp, or a request to facebook.com/tr in the pre-consent section.
  • The Meta Pixel Helper browser extension shows a green pixel and a PageView event while the cookie banner is still open.
  • Your banner says "we only use marketing cookies with your consent", but the cookie list in your browser already contains _fbp on the first page view.

You are not alone. In our scan of 97,304 EU websites, 18.3% (17,793 sites) set marketing cookies before the visitor made any consent choice (full study).

How to check it yourself (5 minutes, no tools to install)

You only need Google Chrome. The same steps work in Edge and, with slightly different menu names, in Firefox.

  1. Open a new private window (Chrome: three-dot menu, "New Incognito window"). This gives you a visitor with no saved cookies and no earlier consent.
  2. Press F12 (Mac: Cmd + Option + I) to open DevTools before you load your shop.
  3. Click the Network tab. In the filter box at the top, type facebook.
  4. Now type your shop address in the address bar and press Enter. Do not touch the cookie banner.
  5. Look at the list. If you see requests to connect.facebook.net (the script that loads the pixel, usually fbevents.js) or to facebook.com/tr (the pixel sending an event), the pixel is running before consent.
  6. Click the Application tab, then on the left open Cookies and click your shop's address. Look for _fbp and _fbc. If they are there and you still have not clicked the banner, a marketing cookie was set before consent.
  7. Click the very first request in the Network tab (your page itself, filter cleared). Open Headers and scroll to Response Headers. If you see Set-Cookie: _fbp=... there, the cookie is being set by your server, not by a script. Keep that in mind, because it changes the fix.
  8. Now click Reject (or "Decline") on your banner, reload the page and repeat steps 5 and 6. Nothing from Facebook should appear after a rejection either.

Write down what you found: script before consent, cookie before consent, server-side cookie, or still tracking after reject. You will need it below.

Why this happens on WooCommerce

In order of how often we see them:

  1. The pixel is added by a plugin your cookie banner does not control. The official Meta for WooCommerce plugin (formerly Facebook for WooCommerce), PixelYourSite and similar plugins add the pixel themselves. Your consent plugin can only block what it recognises.
  2. The cookie is set on the server. An open issue on the plugin's public GitHub repository reports that Meta for WooCommerce can set _fbp (and _fbc when the visitor arrives from a Facebook ad link with fbclid in the address) through Set-Cookie headers on a first visit, before any consent is given (issue #4061). A banner that only blocks scripts in the browser cannot stop a cookie that arrives with the page itself.
  3. The pixel exists twice. For example once through the plugin and once through Google Tag Manager or a code snippet in the theme. You fix one copy and the other keeps firing.
  4. A caching or speed plugin changes the order of scripts. If your consent script is delayed, combined or moved down the page, the pixel can run first. Complianz and CookieYes both document this as a common cause.
  5. The banner is not set to block at all. For example, CookieYes does not block cookies when the consent type is set to "Info" (CookieYes docs).

The fix

Start with step 1, then follow the section for your consent plugin. Test after every change (see "How to verify the fix" below).

Step 1: find every place the pixel comes from

  • In the private window, install nothing yet. Open DevTools, Network, filter fbevents, reload. Click the request and open the Initiator tab. It shows which file loaded the pixel: a plugin folder such as wp-content/plugins/facebook-for-woocommerce/, googletagmanager.com (your GTM container) or your theme.
  • In WordPress, check Plugins for Meta for WooCommerce, PixelYourSite, "header and footer" snippet plugins, and your theme's custom code fields.
  • Keep one source for the pixel. Remove the others. Two pixels mean two things to fix and double-counted conversions.

Step 2a: if you use Complianz

  1. In WordPress go to Complianz, then Integrations, and make sure Facebook is enabled under services. The Complianz documentation says that when Facebook is enabled under integrations, it is blocked by default and "will work with related plugins as well" (Complianz: WooCommerce integrations).
  2. If the pixel still fires, add it by hand in the Script Center (inside Integrations): use "Block a script, iframe or plugin" and enter connect.facebook.net as the URL that should be blocked before consent (Complianz: integrating plugins).
  3. Exclude the Complianz files from your speed plugin's "minify", "combine", "delay" and "defer" options. Complianz lists the keywords complianz and cmplz for this (Complianz: caching plugins).

Step 2b: if you use CookieYes

  1. Check the consent type in CookieYes. Blocking only happens in the "Explicit" and "Implicit" types, not in "Info".
  2. If the pixel is not blocked automatically, go to Cookie Manager, click + Add Cookie and fill in Script URL Pattern (CookieYes: prior consent). We suggest connect.facebook.net as the pattern and the category that covers advertising.
  3. Make sure the CookieYes script is at the top of the page and excluded from optimisation plugins (CookieYes troubleshooting).

Step 2c: if the pixel runs through Google Tag Manager

Give the Meta tag a consent requirement: open the tag, Advanced Settings, Consent Settings, choose "Require additional consent for tag to fire" and add ad_storage (Google: consent in Tag Manager). Your banner must update consent through Google Consent Mode for this to work. Our GTM Consent Mode guide covers the details.

If you paste the pixel code yourself, Meta documents a consent switch: call fbq('consent', 'revoke'); before fbq('init', ...) on every page, and fbq('consent', 'grant'); only after the visitor accepts (Meta: GDPR implementation).

If step 7 of the check showed Set-Cookie: _fbp in the page's response headers, script blocking alone will not remove it. Two options:

  • Use the plugin's own consent feature. Since version 3.7.0, Meta for WooCommerce has a "Hold/Release Signals" feature that keeps Meta signals (the pixel's events and the server-side events) on hold until your consent plugin allows them. The plugin's GitHub repository has step-by-step setup guides for Complianz and CookieYes. Both involve adding a small file to your site (a "must-use plugin"), so hand them to whoever maintains your site. Note that the Complianz guide asks you to switch off Complianz's automatic Facebook for WooCommerce integration from step 2a when you use this feature, so pick one approach, not both. Test again after every plugin update.

  • Or switch the pixel to a source your banner fully controls, for example a single Meta tag in GTM with the consent check from step 2c, and turn off the pixel in the plugin.

How to verify the fix

Repeat the check from the top, in a new private window each time (close the old one first so its cookies are gone):

  1. Before any click: Network filter facebook shows no requests. Application, Cookies shows no _fbp or _fbc. The page's response headers contain no Set-Cookie for _fbp. If you use the plugin's Hold/Release Signals feature, its guide notes that the pixel library itself may still load while signals are held; in that case check that no facebook.com/tr requests are sent and follow the test steps in that guide.
  2. After Reject and a reload: still nothing from Facebook, on the homepage and on a product page.
  3. After Accept (new private window): fbevents.js and facebook.com/tr appear, and the Meta Pixel Helper shows your PageView. This proves you did not break tracking for visitors who agree.
  4. Add a product to the cart and check that the AddToCart event only appears after Accept.

If step 3 shows nothing even after Accept, your consent plugin is blocking the pixel but never releasing it. Check that the category you used (marketing or advertisement) matches the button the visitor clicks.

Keep it fixed

Meta, WooCommerce and consent plugins update often, and every update can change the order in which scripts load. A fix that works today can quietly stop working after the next plugin update. Re-run the check after every update, or let a scanner do it for you.

Sample scan

78 / 100

High risk · Trackers: 23 · Pre-consent tracking: yes

See sample report →

For the general background on this finding, read Pre-consent tracking: what it is and why it matters. If you also run Google Ads or GA4, continue with GA4 and Google Ads on WooCommerce: Consent Mode v2.

Check your site in 1 minute

Our free scan opens your shop in a clean browser, records every request before and after the banner, and shows you exactly which pixel fired too early. No signup needed. Run a free scan.

Get alerted when it breaks

A plugin or theme update can bring the pixel back before consent without anyone noticing. With monitoring, we re-scan your site on a schedule and email you when tracking before consent appears again. Create an account and add your site.

Last updated: