This page is the how-to for a custom pixel. For how Meta matches events in general and how to read its report, see Meta event deduplication on Shopify.
The rule Meta applies
Meta's page on deduplicating pixel and server events says two things must match:
- the pixel's
eventIDand the Conversions API'sevent_id; - the pixel's event name and the Conversions API's
event_name, for example bothPurchase.
Meta deduplicates only events received within 48 hours of the first event with that ID. The value should be unique, and Meta's parameter reference names order numbers and transaction IDs as good choices.
Where the event ID goes in the pixel
Meta's page shows it as the fourth argument of the fbq call:
fbq('track', 'Purchase', {value: 12, currency: 'USD'}, {eventID: 'EVENT_ID'});When you have more than one pixel on the page and want to send to one of them, Meta's page shows trackSingle with the pixel ID first and the same fourth argument.
Which value to use on Shopify
Use the order. In a custom pixel the purchase comes from Shopify's checkout_completed event. Shopify's reference says its checkout.order.id is the ID of the resulting order and is filled only on checkout_completed. Your server learns about the same order from Shopify after payment, with its own copy of the order ID.
So a custom pixel purchase looks like this, after Meta's base code:
analytics.subscribe("checkout_completed", (event) => {
const checkout = event.data.checkout;
fbq('track', 'Purchase', {
currency: checkout.currencyCode,
value: checkout.totalPrice.amount,
}, {eventID: String(checkout.order.id)});
});Do not use Shopify's own event.id for this. It is the ID of the customer event in the browser, and your server never sees it.
Make both sides send the same string
Both sides must send exactly the same characters. An ID can come in more than one form, for example a long form with a prefix in one place and the plain number in another, or the order number with its # sign. Meta compares the strings as they are.
Check it with one real order:
- 1Open your custom pixel under Settings > Customer events and click Test. The Shopify Pixel Helper opens your store.
- 2Place an order with a low price product. In the helper, expand
checkout_completedand note the value ofcheckout.order.id. - 3In your server's log for the same order, note the
event_idit sent to Meta. - 4Compare the two. If they differ, change one side so it builds the same string, for example strip the prefix on one side or add it on the other.
- 5In Meta Events Manager, open Test events and look at the Purchase from the browser. Its event ID should be the string you noted. See Meta Test Events for a Shopify store for why the server copy may not show there.
- 6Refund or cancel the test order.
A day later, open Event Details for Purchase and the Event Deduplication tab. The share of events with the event ID should be high on both sources.
What else can break the match
- The server sends days later. A copy that arrives more than 48 hours after the first one is counted again.
- Different event names.
Purchaseon one side and a custom name on the other never match. - A third sender. A theme snippet or an old Tag Manager tag that sends Purchase without the ID adds a copy Meta cannot match. List every sender first: see Meta counts purchases twice.
- The buyer declined marketing. Your custom pixel does not run for a buyer who did not give the permissions it needs, and your server should not send that order either. Nothing to match, which is correct.
The Facebook & Instagram app next to your custom pixel
The Facebook & Instagram app has its own pixel, and at higher data sharing levels its own server copy. You do not set its event IDs. Sharing an ID with it means reading the ID its pixel sends, which takes custom work. Next to your own sender of Purchase, it is one more sender.
The plain fix is to turn its sharing off, so your custom pixel and your server are the only senders:
- 1In your Shopify admin, go to Sales channels > Facebook & Instagram and open the Settings tab.
- 2Under Share data, click Change.
- 3Turn Share data off and click Save.
This stops every event the app sends to Meta, not only purchases: page views, add to cart and checkout events too. Your custom pixel then has to send the events you still want, such as page views for your audiences. Decide that before you switch.
The ways to send the server copy are in the Meta Conversions API on Shopify.
FAQ
Can I use the order number instead of the order ID?
Yes, if both sides use the same value. The server and the pixel must agree on one field and one format.
My page has two Meta pixels. Which one gets the event ID?
Meta's page shows trackSingle for sending an event to one specific pixel, with the same fourth argument. Each pixel then needs its own server copy with the same ID. See Two Meta pixels on one Shopify store.
Do I need the event ID for events other than Purchase?
For any event that both the browser and the server send. Each one needs its own matching pair.
Where Tikra fits
Tikra sends each paid online order of your store from our server to Meta through the Conversions API, as a Purchase, and keeps a record for each order: what was sent, when, and Meta's answer. Each order's page lists the event IDs it sent.
A new Meta connection starts in a check before sending, and Meta gets nothing from Tikra during it. With a key that can read your pixel's statistics, Tikra reads Meta's own count every day for at least 48 hours and shows whether another connection still sends your purchases; with another key, sending starts after you turn the store's own Meta purchase tracking off and confirm it on the Meta card. Tikra applies your customers' consent choices to every order, and in Strict mode an order is sent only with the buyer's consent. A written guarantee in our Terms covers eligible orders: at least 97 % reach each platform, fixed within 12 hours or a month's fee credited (Terms of Service, section 8).
The free diagnosis sends none of your orders anywhere. It shows your paid orders of the last 7 full days, how many came from a Meta, Google or TikTok ad, and, after a full day and 10 paid online orders, how many your shoppers' browsers reported. With a key that can read your pixel's statistics, it also shows Meta's count and flags when Meta counts some purchases twice.