Meta Pixel event builder
Build an fbq() call for a standard or custom Meta Pixel event, with the parameters Meta actually needs.
Standard events can be optimised for and used in attribution. A custom event cannot be a conversion objective.
Only used when Event is set to Custom.
ISO 4217. A value without a currency is ignored by Meta entirely.
Must match the IDs in your catalogue feed exactly, or dynamic ads cannot match them.
Send the same ID from the browser and the Conversions API so one purchase is not counted twice.
Pixel event code
fbq('track', "Purchase", {
value: 49.99,
currency: "USD",
content_ids: ["SKU-12345"],
content_type: "product",
});Before you ship this
- Note: If you also send this event from the Conversions API, add a matching event ID to both. Without it the same conversion is counted twice.
- Warning: This must not run before the visitor has consented to marketing cookies in regions that require it. Gate it on your consent tool rather than firing it on page load.
How to use it
- Pick the event. Standard events can be optimised for and used in attribution; a custom event cannot be a campaign objective.
- Add value and currency for anything with revenue attached. Meta discards a value that arrives without a currency.
- Add content IDs matching your catalogue feed exactly, so dynamic retargeting has something to show.
- If you also send this event from the Conversions API, put the same event ID in both so one purchase is not counted twice.
Standard events are a short list on purpose
Meta maintains about seventeen standard events because those are the ones its optimisation models are trained on. When you send Purchase with a value, the bidding system knows what that means and can go looking for people likely to generate more of them.
Send CompletedCheckoutFlowV2 instead and none of that applies. The event is recorded, you can build an audience from it, and that is all. The machinery you are paying for does not engage.
Value and currency travel together
There is no default currency. A value: 49.99 with no currency is simply dropped, and because the event itself still registers, the failure looks like an attribution problem rather than a payload problem. Always send both, always as a number and a three-letter ISO code.
Browser and server together, deduplicated
The browser pixel is blocked by tracking protection, ad blockers and iOS more often than most people assume. The Conversions API is not, but it misses the browser context that helps matching. Running both and deduplicating on a shared event ID is the configuration Meta recommends, and it recovers a real share of conversions.
It only works if the IDs match. Use your order number — something both sides already know without coordination.
Consent comes first
Nothing here should run before the visitor has agreed to marketing cookies in a region that requires consent. Firing the pixel on page load and asking afterwards is the single most common compliance failure on commercial sites, and it is the one regulators look for first.
Meta Pixel event builder FAQ
When should I use trackCustom instead of track?
Only when nothing in the standard list fits. Standard events can be chosen as a conversion objective and used in value optimisation; a custom event appears in Events Manager and can be built into an audience, but cannot be the thing a campaign optimises toward. If your event is a purchase, a lead or a sign-up, map it to the standard event.
Why is my purchase value not showing in Meta?
Usually one of two things: the value arrived without a currency, in which case Meta discards it, or it arrived as a string rather than a number. Check the payload in the Meta Pixel Helper extension — it shows exactly what was received.
What is the event ID for?
Deduplication. If the same purchase fires from the browser pixel and from the Conversions API, Meta counts it twice unless both carry the same event ID. With the ID present it keeps one and uses the other to fill in whatever the first one missed, which is the whole point of running both.
Can I send customer email addresses with the event?
Not as plain event parameters. Customer details belong in Advanced Matching, where they are hashed in the browser before being sent, or in the Conversions API. A plain-text email in an event payload is visible in the browser console and goes to Meta unhashed.
Do I still need the Conversions API if the pixel works?
Yes, if the events matter commercially. Browser-only tracking loses a meaningful share of conversions to ad blockers, tracking prevention and people who never load the script, and that loss is not random — it skews towards the privacy-conscious audiences some businesses most want. Running both with deduplication recovers most of it.
Should the pixel go in Tag Manager or directly in the page?
Either works. Tag Manager is easier to wire to a consent banner and to change without a deploy; hard-coding is faster and has fewer moving parts. What matters more is that one of them owns the pixel — a page with the base code in both fires everything twice.
How long is the deduplication window?
Meta matches a browser and server event sharing the same event name and event ID within roughly 48 hours. Anything outside that is treated as two separate events. For a purchase fired at the same moment from both sides this is never a problem; for a server event queued and retried later, it can be.
What exactly should the content IDs contain?
The same identifiers as your catalogue feed, character for character, with the content type set to match. If the feed uses SKU-00123 and the pixel sends 123, dynamic retargeting has nothing to show and the ads fall back to generic creative. This mismatch is the single most common reason a catalogue campaign underperforms.
Why does Events Manager show fewer events than my analytics?
Blocked scripts, consent refusals and app tracking restrictions together remove a large slice of browser events, and Meta drops anything it cannot attribute. A gap of 20% or more is ordinary. The fix is the Conversions API, not more browser tags.
When should the pixel fire relative to consent?
After it, where consent is required. A pixel that fires on page load and waits for the banner has already sent a PageView, which in the EEA is the thing you were supposed to ask about. Gate the base code itself, not just the conversion events.