Facebook Consent Mode is a feature offered by Meta (formerly Facebook) that enables websites and apps to manage how user consent for data collection impacts Meta Pixel functionality.
The Meta pixel is a code snippet used to track user behavior on websites and apps for advertising and analytics purposes.
Contents
How does Meta Consent Mode work?
By adding a small code snippet to your Meta ads pixel you can revoke consent and stop the pixel from sharing data with Meta before the user has consented. Based on the users’ choices, Meta Consent Mode adjusts the behavior of the Meta Pixel.
Meta Consent Mode offers various functionalities depending on user consent selections:
- No Consent: If a user doesn’t grant consent, the Meta Pixel won’t send any data to Meta’s servers.
- Limited Consent: Users might allow specific data collection (e.g., for website analytics) but not for ad targeting purposes. In this case, Meta Pixel would only send the permitted data.
- Full Consent: If your users allow all data collection the Meta Pixel will collect all usual data for optimal ad performance.
Why should you use Meta Consent Mode?
- Privacy Compliance: Like Google Consent Mode, Meta Consent Mode helps websites and apps adhere to user privacy regulations by respecting user choices for data collection with the Meta Pixel.
- Data Control: It allows websites and apps to maintain control over the data collected by the Meta Pixel, ensuring it aligns with user consent preferences.
- Continued Pixel Functionality: Even with limited consent, Meta Consent Mode allows for continued use of the Meta Pixel for permitted data collection, enabling some level of website and app analytics.
Implementing Facebook Consent Mode
You can easily implement the Facebook Consent Mode with a few changes to the Facebook Pixel code or by implementing a CMP that supports it like Cookiescript.
Step 1: Find the Facebook Pixel Code located in the site header or in GTM.
!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-goes-here}');
fbq('track', 'PageView');
Step 2: Add the following code before the init call in your Meta Pixel code.
fbq('consent','revoke');
Now, the code should be like this:
!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('consent', 'revoke');
fbq('init', '{your-facebook-pixel-id}');
fbq('track', 'PageView');
Step 3: Use your CPM to revoke or grant consent after banner interaction
function handleConsent(hasConsent) {
fbq("consent", hasConsent ? "grant" : "revoke");
}
Overall, Meta Consent Mode is a valuable tool for websites that use the Meta Pixel and want to ensure their data collection practices comply with user privacy regulations.
It allows for a balance between respecting user consent and maintaining some level of data collection for analytics purposes.
Feel free to get in touch for any further questions.