DEV Community

ef 32d
ef 32d

Posted on

Your Shopify pixel is underreporting purchases: the server-side fixes that actually matter

If you run paid traffic to a Shopify store in 2026, the browser pixel is lying to you. Not maliciously — it just never sees the conversion. Safari strips the query string after 7 days, ATT means half your iOS traffic never fires the pixel at all, and roughly a third of desktop users run an ad blocker. The platform then reports fewer conversions than you actually had, and you cut budget on campaigns that were working.

Server-side tracking fixes the observation problem. Here is the part most setup guides skip.

What actually happens on a purchase

Browser-side, the flow is: page loads → pixel fires → request goes from the customer's browser to Meta. That request is a third-party request from connect.facebook.net, which is exactly what blockers and ITP target.

Server-side, the flow is: order created on Shopify → your server assembles the payload → your server calls the Conversions API directly. The request originates from your IP, not the customer's, and carries no third-party cookie dependency. Match quality goes up because you control what identifiers you send.

The identifier ladder

Meta's matching is greedy in a specific order. Send as much as you legally can:

em  → SHA-256 of lowercased, trimmed email
ph  → SHA-256 of E.164 phone, digits only, no +
fn  → SHA-256 of lowercased first name
ln  → SHA-256 of lowercased last name
ct  → SHA-256 of lowercased city, no spaces
st  → SHA-256 of 2-letter state code
zp  → SHA-256 of 5-digit zip
country → 2-letter ISO, NOT hashed
external_id → your customer id, NOT hashed
fbp / fbc → raw cookie values, NOT hashed
Enter fullscreen mode Exit fullscreen mode

Two mistakes I see constantly:

  • Hashing country or external_id. Meta expects those in plaintext and silently drops the hashed version.
  • Hashing the plus sign in a phone number. +1 415 555 0100 must become 14155550100 before hashing, not +14155550100.

Deduplication is the whole game

If both the browser pixel and the server fire the Purchase event without a shared key, Meta counts two purchases. Your ROAS looks great and your actual revenue does not change.

The fix is a shared event_id:

// browser
fbq('track', 'Purchase', {value: 89.00, currency: 'USD'},
    {eventID: 'order_10231'});

// server, same order
{
  "event_name": "Purchase",
  "event_id": "order_10231",
  "event_time": 1763500000,
  "action_source": "website",
  "custom_data": { "value": 89.00, "currency": "USD" }
}
Enter fullscreen mode Exit fullscreen mode

Meta dedupes on event_name + event_id within a 48-hour window and keeps the first one it receives. Use the Shopify order id — it is stable, unique, and available on both sides.

First-party pixel, and why it matters more than people think

Serving https://yourdomain.com/… instead of https://connect.facebook.net/… puts the request in first-party context. Blocklists key on third-party hostnames, so a script served from your own domain slips past most of them. The tradeoff: you now proxy the request, and you must keep the proxy path stable or you break in-flight attribution.

The thing that surprised me

After moving to server-side, the reported conversion count went up, but so did reported CPA — because Meta was finally seeing the ~30% of purchases it had been blind to, including a long tail of low-value orders from prospecting audiences. The campaigns had not gotten worse. The measurement had gotten honest, and the honest number was less flattering than the pixel-only number.

That is the real reason to do this: not to make reports look better, but to stop optimizing against a number that is systematically wrong in one direction.

If you want the prebuilt version for Shopify, I maintain GotTracked — server-side events to Meta CAPI, TikTok Events API and Google Ads, first-party pixel on your own domain, UTM capture, and ad spend reconciled against order-level revenue.

Top comments (1)

Collapse
 
omyvnss profile image
Om Yaduvanshi •

the cpa going up after the fix is the part most guides leave out. a higher count with a worse cpa reads like a failure until you remember the pixel was only counting the easy half. on the dedup point, do you check event match quality before and after, or just the count? i've found that is the quicker way to tell whether the extra identifiers are actually landing, rather than just more events getting through.