Support articles

Before contacting the support team, check if your question is already answered here.

How to Integrate CookieForte with Facebook Pixel Consent Mode

Facebook Pixel consent mode ensures that your Facebook Pixel respects user privacy choices by only tracking users who have given appropriate consent. This guide shows you how to integrate CookieForte with Facebook Pixel consent mode for GDPR compliance.

Step 1: Enable Facebook Consent Mode in CookieForte

To activate Facebook Pixel consent integration:

  1. Go to Websites and banners
  2. Choose your banner
  3. Click on the Settings tab
  4. Make sure Facebook Consent Mode is switched on

This setting tells CookieForte to communicate with Facebook Pixel about user consent status.

Step 2: Configure Cookie Category

Select which cookie category controls Facebook Pixel activation:

  1. In the same Settings section, choose the Cookie category that users must agree to for enabling Facebook Pixel
  2. By default, it is set to Marketing - this is the most commonly used option
  3. You can change this to a different category if needed for your specific use case

When users accept this cookie category, Facebook Pixel will be enabled. If they decline, it will remain disabled.

Step 3: Modify Your Facebook Pixel Code

You need to make one important modification to your Facebook Pixel code by adding the consent revoke line.

Original Facebook Pixel Code

<script>
  !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>

Modified Facebook Pixel Code

Add fbq('consent', 'revoke'); just before the fbq('init', 'your-pixel-id'); line:

<script>
  !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('consent', 'revoke')
  fbq('track', 'PageView');
</script>

Note the added line: fbq('consent', 'revoke'); (3rd line from the bottom)

And that's it! Your integration is complete.

What This Code Does

  • The fbq('consent', 'revoke'); line sets the initial state to "no consent"
  • CookieForte will then automatically call fbq('consent', 'grant'); when users accept the appropriate cookie category
  • This ensures Facebook Pixel only tracks users who have explicitly consented

Step 4: Verify Integration

Testing with Meta Pixel Helper

You can check if the integration is working correctly:

  1. Install the Meta Pixel Helper plugin in your Chrome browser
  2. Visit your website with the modified code
  3. Check the plugin status:
    • Green status: Facebook Pixel is enabled (user has consented)
    • Yellow status: Facebook Pixel is not enabled (user hasn't consented or declined)

Expected Behavior

  • Before consent: Facebook Pixel is in revoked state (yellow in Meta Pixel Helper)
  • After accepting marketing cookies: Facebook Pixel activates (green in Meta Pixel Helper)
  • After declining marketing cookies: Facebook Pixel remains disabled

Troubleshooting

  • Pixel always active: Check that you've added the fbq('consent', 'revoke'); line
  • Pixel never activates: Verify Facebook Consent Mode is enabled in CookieForte settings
  • Wrong category triggering: Confirm you've selected the correct cookie category in Settings

Your Facebook Pixel will now respect user privacy choices while maintaining full functionality for consenting users.