Meta Conversions API: How to Set It Up and Deduplicate Events
Advanced4 minInnovialabs editorial team
In short
Conversions API sends events to Meta from your server alongside the pixel; to avoid double counting, both sources must send the same event_name and event_id, and good matching needs normalised, SHA-256 hashed customer data.
The short answer: how it works
Meta Conversions API (CAPI) sends events (lead, purchase, sign-up) to Meta from a server instead of the browser. CAPI usually runs alongside the pixel:
- the pixel captures browser events and on-site behaviour;
- CAPI sends the same events from the server and delivers them even when the browser request is blocked or lost;
- Meta deduplicates the pairs and counts each event once — provided you send matching identifiers.
The server can also send events that never happen in the browser, such as a payment confirmed in the CRM.
Integration options
| Method | When it fits | What to watch |
|---|---|---|
| Partner integration (CMS, site builders, e-commerce platforms) | Site runs on a popular platform | Limited flexibility; check that event_id is passed |
| Conversions API Gateway | Need it fast without backend development | Deploys in your cloud, requires hosting |
| Server-side GTM | Server-side tracking already in place | event_id must be passed correctly from the web container |
| Direct integration via Graph API | Custom development, events from backend and CRM | Maximum flexibility, but everything is on your side |
Deduplication with event_id
Meta treats two events as duplicates when their event_name and event_id match and they belong to the same pixel. So the ID must be generated once and sent through both channels.
In the browser:
const eventId = crypto.randomUUID();
fbq('track', 'Lead', { value: 0, currency: 'USD' }, { eventID: eventId });
// send the same eventId to your server together with the form data
On the server, the same value goes into event_id:
{
"data": [{
"event_name": "Lead",
"event_time": 1760000000,
"event_id": "same-uuid",
"action_source": "website",
"event_source_url": "https://example.com/contacts",
"user_data": {
"em": ["<sha256 email>"],
"ph": ["<sha256 phone>"],
"client_ip_address": "203.0.113.10",
"client_user_agent": "Mozilla/5.0 ...",
"fbp": "fb.1.1700000000000.123456789",
"fbc": "fb.1.1700000000000.AbCdEf"
}
}]
}
Common causes of duplicates: different event name spelling (Lead vs lead), event_id generated separately in the browser and on the server, or the server event sent with too long a delay.
Event Match Quality
Event Match Quality (EMQ) is a score in Events Manager that shows how well Meta can match your server events to user accounts. The higher it is, the more accurate attribution and optimisation become.
How to improve it:
- send email and phone when the user has provided them;
- send fbp (the
_fbpcookie) and fbc (the_fbccookie or thefbclidURL parameter); - include the client's IP address and user agent, not your server's;
- use external_id — your internal user ID, identical in the pixel and CAPI.
Hashing customer data
Personal data (email, phone, name, city and so on) must be normalised and hashed with SHA-256 before sending. Do not hash IP, user agent, fbp or fbc.
import { createHash } from 'node:crypto';
const sha256 = (v) => createHash('sha256').update(v).digest('hex');
const em = sha256(' User@Example.com '.trim().toLowerCase());
const ph = sha256('+998 90 123-45-67'.replace(/\D/g, '')); // digits only, with country code
A normalisation mistake (a space, a capital letter, a plus sign in the number) produces a different hash and no match.
Verifying in Events Manager
- Open Test Events, copy the
test_event_codeand add it to server requests while debugging. - Perform an action on the site and confirm the event arrives from both the browser and the server.
- In the event details, check the deduplication status: the pair should be shown as handled.
- After a while, review EMQ and the Diagnostics tab for errors and recommendations.
- Remove
test_event_codebefore going to production.
Request format details are in the Meta documentation.