Consent tool guide · CookieYes
Meta Pixel and CookieYes: fire only after cookie consent
For the findings “Meta Pixel fires before cookie consent” and “Meta Pixel does not fire after cookie consent”. See also the general guide.
What goes wrong with CookieYes and the Meta Pixel
A working setup does two things: the Meta Pixel sends nothing while the CookieYes banner is waiting for an answer, and it sends a PageView right after the visitor accepts advertisement cookies, on the same page. Broken setups usually fail in one of two ways:
- The pixel fires before consent. The pixel runs before or outside CookieYes’s blocking: it is added through Google Tag Manager (GTM) on an “All Pages” trigger, a caching plugin delays the CookieYes script, or the banner uses a consent type that does not block anything.
- The pixel stays silent after consent. The pixel is held back correctly, but its release is tied to the wrong category or to a trigger that ran before the visitor clicked.
In our scan of showcase sites, one of the ten CookieYes sites with a Meta Pixel sent pixel data before the visitor answered the banner. Ten sites is far too few for a rate, so treat this only as a reminder to test your own setup.
We report technical behaviour only; we cannot tell you whether your setup is legally compliant.
How to check your site
- Open a private (incognito) window, open developer tools (F12), go to the Network tab and type
facebook.com/trinto the filter. If your banner only appears in some countries, test from one of them (for example with a VPN). - Load the page and do not touch the banner. Any
facebook.com/trrequest at this point means the pixel fires before consent. - Accept all cookies. Within a few seconds you should see a request with
ev=PageViewon the same page. If it only appears after you open another page, you lose the first page view of every new visit. - In the Application tab, open Cookies and look at the
cookieyes-consentcookie. After you accept, its value should containadvertisement:yes. - In a fresh private window, reject all cookies. No
facebook.com/trrequests should appear.
Meta Ads Data Advisor (formerly Meta Pixel Helper), Meta’s Chrome extension, shows the same events if you prefer not to read network requests.
How to fix it
First find every copy of the pixel: search the page source for fbevents.js and fbq(, and check your GTM container, plugins and shop apps. Choose one of the routes below and remove the other copies.
Whatever route you choose, check the banner settings first: CookieYes only blocks cookies in the Explicit and Implicit consent types. With the Info type, nothing is blocked.
Pixel in Google Tag Manager
- Load CookieYes with the CookieYes CMP template from GTM’s Community Template Gallery, on the Consent Initialization - All Pages trigger, with Support GCM enabled in your CookieYes settings. CookieYes warns that also adding its script to the page by hand can conflict with this setup. (CookieYes says this template method does not apply to its WordPress plugin; plugin users should follow the plugin’s own Consent Mode guide.)
- Create a 1st Party Cookie variable that reads the cookie
cookieyes-consent. - Create a Custom Event trigger with the event name
cookie_consent_update, set to fire on Some Custom Events when that variable containsadvertisement:yes. If Support GCM is switched off, CookieYes says to use.*(with regex matching) as the event name instead. - Make this the Meta tag’s only firing trigger and remove All Pages. Google Consent Mode only adjusts Google tags with built-in consent checks; a Meta tag has none, so it needs its own consent condition. You can also add
ad_storageunder Advanced Settings > Consent Settings > Require additional consent for tag to fire (CookieYes maps its Advertisement category toad_storage), but GTM checks that setting only when the tag is triggered. A tag on All Pages is checked once, before the click, and never again on that page. - Under Advanced Settings > Tag firing options, choose Once per page, so a visitor who changes their choice does not send a second
PageView.
Pixel in your site code or added by a plugin
CookieYes blocks well-known third-party scripts, Facebook pixels included, until the visitor consents. The inline base code itself does not need extra markup: CookieYes says its data-cookieyes attribute is only required on external scripts that use a src attribute. The script the base code loads (fbevents.js) comes from connect.facebook.net, so that is the address to target if the pixel still fires before consent:
- In the Cookie Manager, open the Advertisement category, add (or edit) the Meta cookie and set its Script URL Pattern to
connect.facebook.net. - If a plugin loads the pixel from its own script file, add the attribute to that script tag, using the advertisement category:
data-cookieyes="cookieyes-advertisement".
Alternatively, use Meta’s consent API, which keeps the pixel loaded but paused. CookieYes documents this pattern: call fbq('consent', 'revoke') before fbq('init', ...), then update consent from CookieYes’s events:
document.addEventListener('cookieyes_banner_load', function (e) {
if (e.detail.categories && e.detail.categories.advertisement) {
fbq('consent', 'grant');
}
});
document.addEventListener('cookieyes_consent_update', function (e) {
fbq('consent', e.detail.accepted.includes('advertisement') ? 'grant' : 'revoke');
});
The category key stays advertisement even if you renamed the category in the banner. These events do not work with the CookieYes WordPress plugin unless it is connected to the CookieYes web app.
CookieYes automatic blocking
Automatic blocking can only hold back scripts that load after the CookieYes script, so:
- Place the CookieYes script before the pixel and any other tracking code.
- Exclude CookieYes from caching and optimisation plugins that delay, combine or defer JavaScript. CookieYes has exclusion guides for WP Rocket, LiteSpeed Cache, SG Optimizer and NitroPack.
- Check that visitors who should get an opt-in banner actually get it: review the consent type (with Info, nothing is blocked) and your geo-targeting settings.
Common causes
Pixel fires before consent:
- The banner uses the Info consent type, which blocks nothing.
- The Meta tag in GTM fires on All Pages with no CookieYes condition.
- A caching or optimisation plugin delays the CookieYes script, so the pixel loads first.
- A plugin or app adds its own browser pixel from a file CookieYes does not recognise.
Pixel silent after consent:
- The Meta tag requires
ad_storagebut is only triggered by All Pages. - The GTM condition or event listener checks the wrong category (for example
analyticswhile the pixel’s cookies sit under Advertisement). fbq('consent', 'revoke')is in place, but the grant never runs, for example because the event listeners are used with the WordPress plugin without a web app connection.
How to verify
- Repeat the private-window test: no requests before you answer the banner, a
PageViewwithin a few seconds after you accept (on the same page), and nothing after you reject. - If you use GTM, open Preview, accept the banner and check that the Meta tag fires on
cookie_consent_update. Then reload: for a returning visitor who already accepted, the tag should fire without any click. If it does not, check which event CookieYes pushes on page load in Preview and add it to the trigger. - Re-run the check on IsPixelWorking.
Questions people ask
Is there a consent mode for Meta?
Meta’s counterpart is the pixel’s consent API: fbq('consent', 'revoke') before fbq('init', ...) pauses sending, and fbq('consent', 'grant') resumes it. CookieYes calls its support for this “Meta Pixel Consent Mode”: it is the event listener example above.
What is the difference between Google Consent Mode and consent controls for the Meta Pixel?
Google Consent Mode passes the visitor’s choice to Google tags, which adjust their own behaviour. A Meta Pixel tag has no built-in consent check, so it needs its own control: the cookie_consent_update trigger with the advertisement:yes condition in Google Tag Manager, CookieYes’s script blocking, or Meta’s consent API.
Can blocking the Meta Pixel affect ad tracking and performance?
Yes. While the pixel waits, Meta receives no pixel events from that visitor, and visitors who reject send none at all, so reported conversions, retargeting audiences and the data Meta optimizes on are smaller. That is why the setups above release the pixel on the same page as soon as the visitor accepts, not one page later.
Sources
- CookieYes, How to Implement Prior Consent and Cookie Auto-Blocking: https://www.cookieyes.com/documentation/implement-prior-consent-using-cookieyes/
- CookieYes, Which third-party cookies are blocked?: https://www.cookieyes.com/documentation/which-third-party-cookies-are-blocked/
- CookieYes, Getting Started with Google Tag Manager and CookieYes: https://www.cookieyes.com/documentation/getting-started-with-google-tag-manager-and-cookieyes/
- CookieYes, Block Third-Party Cookies With Google Tag Manager (GTM): https://www.cookieyes.com/documentation/block-third-party-cookies-with-google-tag-manager-and-cookieyes/
- CookieYes, Meta Pixel Consent Mode: https://www.cookieyes.com/documentation/facebook-pixel-consent-mode/
- CookieYes, CookieYes Events on Cookie Banner Interactions: https://www.cookieyes.com/documentation/events-on-cookie-banner-interactions/
- CookieYes, How to Exclude CookieYes Script from WP Rocket Plugin: https://www.cookieyes.com/documentation/exclude-cookieyes-script-from-wp-rocket-plugin/
- Google Tag Manager Help, Tag Manager consent mode support: https://support.google.com/tagmanager/answer/10718549
- Meta for Developers, General Data Protection Regulation (consent API): https://developers.facebook.com/docs/meta-pixel/implementation/gdpr
- Meta for Developers, Meta Ads Data Advisor (formerly Meta Pixel Helper): https://developers.facebook.com/docs/meta-pixel/support/pixel-helper