How to install Facebook's GDPR-compliant Pixel

In general, the Facebook Pixel is used to track user behavior on your website, such as page views and conversions, and sends this data to Facebook. With the information collected, you can create custom audiences, run remarketing campaigns, and optimize your campaign targeting. This includes automatically excluding users who have already completed "conversions," such as making a purchase, filling out a form, or adding products to their shopping cart.

Due to regulations like the GDPR and cookie law, it is essential to obtain explicit consent from users before engaging in these activities.

In this article, we'll explore how to bring the Facebook Pixel into compliance with GDPR regulations using the My Agile Privacy WordPress plugin. Below is a step-by-step guide:

Solution 1 – Automatic Scan

You can take advantage of the advanced "Cookie Shield" feature.
This mode automatically detects the Facebook Pixel on your website. By setting the Shield to "Learning" mode, the plugin will scan your site’s pages and configure the necessary settings. You may also choose manual configuration if you prefer.

Solution 2 – Manual Configuration

Part 1 – Identify Your Pixel Code

The first step is to locate your Facebook Pixel code.
It will look similar to this example below:

Part 2 – Find the Facebook Pixel Cookie in the My Agile Privacy Cookie List

Go to the "My Agile Privacy" section in your WordPress admin menu and select "Cookie List." Here, you’ll see a list of cookies imported during plugin installation.
By default, these cookies will be in draft status. Be sure to publish only the cookies necessary for your website.

On this screen, you’ll see a number of columns:

  • Cookie Name: the name of the cookie.
  • Is Necessary: Indicates whether the cookie is essential for your website’s functionality. If rejecting the cookie makes your site unusable, it’s considered essential. This detail is pre-filled for each cookie.
  • Auto Update: Specifies if the reference text for the cookie (explained next) is kept up to date automatically. If set to "yes," we will handle updating the cookie references for GDPR compliance.
  • Installation Type: Shows the chosen insertion type for the cookie. This value changes based on the inclusion method required, which will be covered in these guides.

To install the Facebook Pixel cookie, search the list for the entry titled "Facebook Remarketing (Facebook, Inc.)" and click on it.
The detail page provides a pre-filled informational text and two blank fields where you can enter the required code.
The pre-filled text appears in your cookie policy and is automatically updated for compliance when "Allow Automatic Update" is enabled.
Right below the text, you’ll find the option to select the "Type of Installation" (Javascript and Noscript, or Raw).
Keep "Javascript-noscript code" selected; you will then see two fields:

  • Javascript Activation Code – where to enter your main Facebook Pixel code
  • NoScript code – where to enter any NoScript code if necessary

Part 3 – Enter the Facebook Pixel Code

Now you simply need to enter your Facebook Pixel code, found in the first step, into the two fields as shown in the image below.
Be sure to insert the code WITHOUT the opening and closing <script> and </script> tags, or <noscript> and </noscript> tags.
Don’t forget to save and publish your Cookie by clicking the blue "Publish" button in the top right corner.

Final Step – Verifying Proper Operation

Check that the Facebook Pixel is correctly installed on your website using tools provided by Google or Facebook. Visit any page of your site to ensure that the Facebook Pixel remains inactive until the user has given explicit consent to cookie installation. Users can provide this either by clicking "I agree" on the cookie consent banner or by activating the Facebook cookie in the "Customize" section.

Download the free guide

Fill out the form and get immediate access to the guide in PDF format.
Mockup del pdf della guida
Loading in Progress...
Request successfully sent. You will be redirected to the download page shortly
By submitting this form I declare that I have read the privacy policy and authorize the Owner to respond to me for what is expressed in point a of the privacy policy
Warning: Your Cookie choices may not allow the form to be submitted.
Click here to review your preferences.
buy now My Agile Privacy - compliant in less than 3 minutes
a Formula Agile SRL project
COE / TAX ID 31366
Via Tre Settembre, 99 - 47891 Dogana - San Marino - RSM
Share capital 26'000€
For assistance: info[at]myagileprivacy.com
GDPR and privacy present complexities that extend beyond achieving website compliance. Compliance obligations span across all business aspects and necessitate expert analysis.
When it comes to implementing Banners and Policies, trust My Agile Privacy—the only solution that excludes unnecessary implementations not mandated by regulations.
Logo CMP partner GoogleLogo CMP partner GoogleLogo CMP partner GoogleLogo IAB Europe approvedLogo IAB Europe approved