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 tofacebook.com/trin the pre-consent section. - The Meta Pixel Helper browser extension shows a green pixel and a
PageViewevent 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
_fbpon 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.
- 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.
- Press F12 (Mac: Cmd + Option + I) to open DevTools before you load your shop.
- Click the Network tab. In the filter box at the top, type
facebook. - Now type your shop address in the address bar and press Enter. Do not touch the cookie banner.
- Look at the list. If you see requests to
connect.facebook.net(the script that loads the pixel, usuallyfbevents.js) or tofacebook.com/tr(the pixel sending an event), the pixel is running before consent. - Click the Application tab, then on the left open Cookies and click your shop's address. Look for
_fbpand_fbc. If they are there and you still have not clicked the banner, a marketing cookie was set before consent. - 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. - 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:
- 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.
- 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_fbcwhen the visitor arrives from a Facebook ad link withfbclidin the address) throughSet-Cookieheaders 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. - 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.
- 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.
- 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 aswp-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
- 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).
- 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.netas the URL that should be blocked before consent (Complianz: integrating plugins). - Exclude the Complianz files from your speed plugin's "minify", "combine", "delay" and "defer" options. Complianz lists the keywords
complianzandcmplzfor this (Complianz: caching plugins).
Step 2b: if you use CookieYes
- Check the consent type in CookieYes. Blocking only happens in the "Explicit" and "Implicit" types, not in "Info".
- 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.netas the pattern and the category that covers advertising. - 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).
Step 3: the server-side cookie (for whoever maintains your site)
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):
- Before any click: Network filter
facebookshows no requests. Application, Cookies shows no_fbpor_fbc. The page's response headers contain noSet-Cookiefor_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 nofacebook.com/trrequests are sent and follow the test steps in that guide. - After Reject and a reload: still nothing from Facebook, on the homepage and on a product page.
- After Accept (new private window):
fbevents.jsandfacebook.com/trappear, and the Meta Pixel Helper shows yourPageView. This proves you did not break tracking for visitors who agree. - Add a product to the cart and check that the
AddToCartevent 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.
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: