Meta Pixel with Cookie Compliance

Cookbook · guide Last verified View raw markdown (for agents)

In short: keep the Cookie Compliance snippet as the first script in <head>, then paste the Meta Pixel below it. The banner holds the recognised Facebook loader until the visitor allows Ad Personalisation, in regions whose rule requires consent first.

You need #

Where it goes #

Meta's docs place the Pixel between the <head> tags. With Cookie Compliance installed, keep the banner snippet first, then paste the Pixel below it.

Paste the Pixel base code exactly as Events Manager gives it. It is an inline block that loads fbevents.js from connect.facebook.net, followed by a <noscript> image fallback.

What the order controls #

The banner recognises connect.facebook.net (fbevents.js) and holds it under category 4 Ad Personalisation by default. The whole inline block is held when it names that address. In regions whose rule requires consent first, the Pixel waits until the visitor allows that category; it starts after Allow. A script placed above the banner snippet runs straight away.

Confirm the result #

View the page source: the banner snippet comes first in <head>, the Pixel after it. Before choosing, in a region whose rule requires consent first, _fbp (and _fbc once available) are absent; the held script shows type="javascript/blocked" in the Elements panel. After Allow, those cookies appear. Browser checks: plain-html; full procedure: verify-install.

Gotchas #

More help #