Shopify + Meta CAPI: Deduplicating Pixel and Server Events
Here's a ticket that shows up on every store that adds the Conversions API (CAPI): "Meta now reports almost double our purchases. Last month it matched Shopify." Nothing is wrong with Meta. You sent each order twice, and Meta had no way to know they were the same order. This post covers how deduplication works, the fields that make it work, and a pattern for Shopify that survives retries, consent…
Meta deduplicates a browser event and a server event when they share both the same event_name and the same event_id. This matching happens within a limited time window, typically 48 hours, but it's important to check the current documentation. If either field is missed, Meta will count it as two separate purchases. To avoid this, generate the ID once using something both sides already know, such as the order id in the case of purchases.
For Shopify stores, add a custom pixel in Settings > Customer events > Add custom pixel. This custom pixel runs in a sandbox, allowing you to subscribe to Shopify's events instead of reading the page. Use the following event schema and cookie access when adding the custom pixel.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.