Omea Consent Pro · Guides

Meta Pixel on WordPress: GDPR consent before tracking

Add the Meta (Facebook) Pixel to WordPress so it tracks only after GDPR consent: no code with Omea Consent Pro, or the free plugin's Scripts.

Updated · Omea Consent Pro 1.0.8

English
On this page
  1. With Omea Consent Pro (no code)
  2. With the free plugin
  3. Pixel added by another plugin?
  4. Meta’s consent API: fbq('consent', 'revoke') and grant
  5. Own consent mode
  6. When a visitor withdraws

To use the Meta Pixel on WordPress under the GDPR, the pixel must wait until the visitor accepts marketing cookies. It sets the _fbp cookie and sends page views to Meta, and under the GDPR and ePrivacy rules that needs consent – the most common mistake on WordPress sites is a pixel that fires before the visitor has chosen anything. Here’s how to add it so it waits.

Waiting for consent is the first step. Also name Meta in your privacy policy and cookie policy, and explain what is shared with it.

  1. Find your Pixel ID In Meta Events Manager, select your pixel (dataset) and copy its ID – a long number.
  2. Switch on the Meta Pixel integration In WordPress go to Omea Consent › Integrations, switch on Meta Pixel and paste the Pixel ID.
  3. Keep the default loading Leave After Marketing consent (recommended) selected. Click Save changes.
  4. Remove other copies of the pixel Delete the pixel from your theme, other plugins or Scripts, so it loads only once.
  5. Test it In a private window, check that no request goes to facebook.com/tr and no _fbp cookie appears until you accept Marketing. Then use Meta’s Pixel Helper or Test events.

Pro can also send conversions to the pixel – purchases, leads, sign-ups – and send the same events from your server through the Meta Conversions API, still only with consent.

With the free plugin

  1. Copy the pixel’s base code from Meta Events Manager.
  2. Go to Omea Consent › Scripts › Add script.
  3. Name it Meta Pixel, choose the Marketing category and Head location, choose Inline code and paste the snippet.
  4. Click Save script.

The pixel now waits for Marketing consent. See Add tracking scripts that wait for consent.

Pixel added by another plugin?

If a Facebook or WooCommerce plugin adds the pixel, it loads straight away. Either switch the pixel off in that plugin and add it through Omea, or turn on auto-blocking, which holds connect.facebook.net, fbevents.js and fbq( calls until Marketing consent.

Meta’s pixel has its own consent switch (Meta’s GDPR guide): fbq('consent', 'revoke') pauses sending pixel events to Meta, and fbq('consent', 'grant') resumes them once the visitor agrees. Meta’s guide puts revoke before fbq('init', …) and says to call it on every page.

You don’t need to write these calls yourself: Omea Consent Pro’s own consent mode makes them for you, in that order. The default, After Marketing consent (recommended), goes further and doesn’t load the pixel at all until consent.

Pro also offers Own consent mode for the Meta Pixel: the script loads at once with fbq('consent', 'revoke'), and Omea sends grant when the visitor agrees. Meta still receives the visitor’s IP address, browser details and page address before the choice – in the EU, EEA and UK that is likely to need consent under the cookie rules – so it’s not the default. Use it only if your legal adviser agrees. See Own consent mode for Meta, TikTok and UET.

When a visitor withdraws

If a visitor turns Marketing off later, Omea reloads the page and deletes _fbp and _fbc along with the other marketing cookies.