Documentation

Everything you need to know for quick Consentio implementation

Facebook Pixel

Facebook Pixel (Meta Pixel) integration with Consentio

What is Facebook Pixel

Meta Pixel (formerly Facebook Pixel) is a measurement tool for tracking conversions and retargeting on Facebook and Instagram. It allows you to measure ad effectiveness, create custom audiences and optimise advertising campaigns.

Cookie Category

Facebook Pixel belongs to the marketing category.

Consentio Category GCM Signal
marketing ad_storage, ad_user_data, ad_personalization

Installation with Consentio

Add the Facebook Pixel code with type="text/plain" and data-category="marketing" attributes. The Consentio script will activate the pixel only after marketing cookie consent is granted.

HTML
<!-- Facebook Pixel -->
<script type="text/plain" data-category="marketing">
  !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', 'YOUR_PIXEL_ID');
  fbq('track', 'PageView');
</script>

<!-- Noscript fallback -->
<noscript>
  <img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1" />
</noscript>
Warning: Replace YOUR_PIXEL_ID with the actual ID from Meta Business Suite → Events Manager.

JavaScript API Alternative

Dynamically load Facebook Pixel after consent is granted:

JavaScript
// Put this in an inline script in the page HTML: the event is not repeated for a listener added later
let pixelLoaded = false
window.addEventListener('consentio:consent', (event) => {
  if (event.detail.marketing && !pixelLoaded) {
    pixelLoaded = 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', 'YOUR_PIXEL_ID');
    fbq('track', 'PageView');
  }
})

Integration via GTM

If you use Google Tag Manager, set the Facebook Pixel tag to require ad_storage consent. Consentio sends GTM the Google Consent Mode v2 signals, so the tag will only fire after marketing consent is granted.

  1. In GTM, create a new tag of type Custom HTML with the Facebook Pixel code
  2. In the tag settings, go to Consent Settings
  3. Set Require additional consent for tag to fire: ad_storage
  4. Set the trigger to All Pages

Google Consent Mode v2

Meta Pixel does not read Google Consent Mode and Consentio sends Meta no signal; the pixel is held back by the marking above. For a tag fired from GTM, these are the signals the marketing category controls:

Consentio Category GCM Signal Description
marketing ad_storage Advertising storage
marketing ad_user_data Sharing user data with advertising platforms
marketing ad_personalization Ad personalisation

Verification

  1. Install the Meta Pixel Helper extension in Chrome
  2. Before granting consent: the pixel should not send any events
  3. After granting marketing consent: the pixel should send a PageView event
  4. Verify in Meta Business Suite → Events Manager that events are being recorded correctly
Google AnalyticsTikTok Pixel