How to make Facebook / Meta pixel privacy-compliant

Created by illow Info, Modified on Mon, 18 Sep 2023 at 03:53 PM by illow Info

What are we trying to achieve and why is it important?

You might have noticed that even when illow blocks all the cookies on your website, Facebook/Meta's pixel tracks a page view as soon as their <script> tag is loaded, i.e. before your users give their explicit consent!

We are going to modify this behavior in the Facebook pixel to make it privacy-compliant.

You only need to add one line of code to your <script> tag

Add the following line of code before the 'init' command:

fbq('consent', 'revoke');

Like this:

  s.parentNode.insertBefore(t,s)}(window, document,'script',
  fbq('consent', 'revoke');
  fbq('init', '{your-pixel-id-goes-here}');
  fbq('track', 'PageView');

That's it? That's it!

Now no tracking will be done until the user gives explicit consent on the illow notice. illow will then enable the Facebook pixel automatically on that visit and future ones!

Do you use Google Analytics or Google Ads?

Don't forget to set up the Google Consent Mode.

Also learn how to block other third-party scripts and tools that track users without the need for cookies.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article