← All articles
Meta CAPI on WooCommerce: My Server-Side Tracking Checklist
Browser pixels miss a lot of purchases now: ad blockers, iOS privacy rules and short cookie lifetimes all take a cut. Server-side tracking fixes most of that. This is the checklist I follow on every WooCommerce store.
1. Fire the same event twice, on purpose
Send every key event from both the browser pixel and the server. Meta keeps one and drops the other, as long as both carry the same event_id.
// In the browser (GTM custom HTML or theme code)
const eventId = 'purchase_' + orderId;
fbq('track', 'Purchase', { value: total, currency: 'BDT' }, { eventID: eventId });
dataLayer.push({ event: 'purchase', event_id: eventId, value: total });
2. Send hashed customer data from the server
Event Match Quality depends on how much customer data you send. Hash it with SHA-256 first.
<?php
function hash_user_data(array $u): array {
$norm = fn($v) => hash('sha256', strtolower(trim($v)));
return [
'em' => [$norm($u['email'])],
'ph' => [$norm(preg_replace('/\D/', '', $u['phone']))],
'fn' => [$norm($u['first_name'])],
'ct' => [$norm($u['city'])],
];
}
3. Check it in Events Manager
- Open Test Events and place a test order
- Each event should show Browser and Server, marked Deduplicated
- Aim for an Event Match Quality of 8 or more on Purchase
Common mistakes
| Mistake | Fix |
|---|---|
Different event_id on browser and server |
Generate it once, pass it to both |
| Sending plain-text email | Hash with SHA-256 after lower-casing |
| Purchase fires on page refresh | Fire once per order, store a flag |