Integrations
Meta PixelMeta Pixel
preset documentationDocumentation

CookiePilot Meta Pixel preset: _fbp and events only after consent

Hold Meta Pixel until marketing consent. The preset covers common Meta traces such as _fbp, _fbc, connect.facebook.net and facebook.com/tr, plus testing before and after acceptance.

Overview

Hold Meta Pixel until marketing consent. The preset covers common Meta traces such as _fbp, _fbc, connect.facebook.net and facebook.com/tr, plus testing before and after acceptance.

Category

marketing.

Trace

_fbp, _fbc.

Trace

connect.facebook.net, facebook.com/tr.

Consent behaviour

No _fbp before consent.

No facebook.com/tr after Reject.

After Accept, the pixel starts once without duplication.

Setup steps

Remove hardcoded pixel code if it fires before the CMP.

Start Meta after marketing granted.

Check product and checkout in a clean session.

Example snippet

Example snippet

Example snippet
<!-- Do not paste this above CookiePilot. Start Meta only after marketing consent. -->
<script>
window.addEventListener('cookiepilot:consent', function (event) {
  var consent = event.detail || {};
  if (!consent.marketing || window.__metaPixelLoaded) return;
  window.__metaPixelLoaded = true;

  !function(f,b,e,v,n,t,s){
    if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};
    if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
    n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];
    s.parentNode.insertBefore(t,s)
  }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');

  fbq('init', 'META_PIXEL_ID');
  fbq('track', 'PageView');
});
</script>

Test checklist

No _fbp before consent.

No facebook.com/tr after Reject.

After Accept, the pixel starts once without duplication.

Setup steps

  1. 1Remove hardcoded pixel code if it fires before the CMP.
  2. 2Start Meta after marketing granted.
  3. 3Check product and checkout in a clean session.

Test checklist

  • No _fbp before consent.
  • No facebook.com/tr after Reject.
  • After Accept, the pixel starts once without duplication.

FAQ

Is this legal advice?

No. It is an implementation guide. For unusual data flows, confirm the setup with your legal or privacy team.

Does CookiePilot block every script automatically?

CookiePilot supports autoblocking and Consent Mode. Trackers hardcoded before the CMP still need to be moved behind the stub or into GTM Consent Initialization.

Related integrations

See the setups that most often appear together with this integration.

Ready to configure it?

Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.