Technology and development

Pixel and server setup: a practical guide to the Conversions API without duplicates

Pixel and server setup: a practical guide to the Conversions API without duplicates

In short: Connecting your pixel and server means every key event, such as a purchase, reaches the ad platform two ways: from the pixel in the shopper's browser, and from your server through a Conversions API. To stop the order counting twice, send the same event_id and the same event name from both. To help the platform match the buyer, send match keys with the server event: email and phone hashed with SHA-256, plus click IDs, cookies, IP address and user agent unhashed. Then test in each platform's events tool before you trust the numbers.

In our article on server-side tracking we covered why ad data goes missing in the browser and why the server became a core part of measurement. This article is the hands-on part: how to set up the pixel and server together on Meta, Snapchat, TikTok and Google, so they run side by side without double counting and without losing customer matching.

It is written for store owners and marketers in Saudi Arabia who already have a pixel running and have heard from an agency or a platform that they need a Conversions API. You don't need to be a developer to follow it, but some steps will need a developer or a ready-made app from your store platform.

How does the hybrid setup work?

In a hybrid setup you don't remove the pixel. You keep it on the site and add a second path from the server. The pixel captures what the shopper does on the page, and the server sends confirmed events, such as purchases, from the store system itself. If the pixel is blocked or the shopper closes the page too soon, the event still arrives from the server.

Pixel and server setup diagram: the browser and the server send the same event with the same ID to the ad platform

The path, in order:

  1. The shopper completes the order, and the thank-you page fires the purchase event from the pixel with an event ID.
  2. The store system records the order and sends the same purchase event from the server to the Conversions API with the same ID, plus the match data.
  3. The platform receives both copies, compares the ID and the event name, and counts the order once.

The result: you gain the server's coverage without losing the browser's signals, and without doubling your numbers.

Deduplication: the event_id

Deduplication is the platform recognising that the event it got from the pixel and the one it got from the server are a single event. The key is one event ID, generated once and sent from both paths.

Meta's rule

According to Meta's documentation, the two are treated as the same event when the pixel's eventID matches the Conversions API's event_id and the event name also matches, such as Purchase on both sides. Matching applies when the two arrive within 48 hours of each other, and Meta generally prefers the event it receives first. There is an alternative based on fbp or external_id, but the event ID is the clearest method.

Where does the ID come from?

  • For purchases: the order number is a practical choice, because it exists on the thank-you page and in the store system, and never repeats between two orders.
  • For pre-purchase events such as add to cart: generate a random ID in the browser at the moment of the event, send it with the pixel, and pass it to the server in the same request so the server sends it too.
  • Don't generate a separate ID on each side. If the pixel creates one number and the server creates another, the platform sees two events.

Match keys: what to send and what to hash

A server event doesn't carry the browser's cookies automatically, so you have to send the data that helps the platform link the event to the person who saw the ad. The more complete and accurate that data, the higher your event match quality, and the clearer the data the algorithm learns from.

The general rule on Meta and Snapchat: personal data is hashed, technical identifiers are sent as they are.

KeyHash with SHA-256?Where it comes from
EmailYes, after lowercasing and trimming spacesOrder or account data
Phone numberYes, digits only, with the country code (966 for Saudi Arabia)Order data
IP addressNoThe shopper's request to your server
User agentNoThe shopper's request to your server
fbp and fbc (Meta)NoThe _fbp and _fbc browser cookies
sc_click_id (Snapchat)NoThe ScCid parameter in the ad URL
sc_cookie1 (Snapchat)NoThe _scid browser cookie

An example of preparing a phone number before hashing: 05xxxxxxxx becomes 9665xxxxxxxx, with no plus sign, spaces or dashes. If a field is empty, don't fill it with a placeholder; leave it out.

TikTok also asks for email and phone hashed with SHA-256 in advanced matching. Google hashes customer data with the same algorithm in enhanced conversions.

Pixel and server setup on the four platforms

Each platform names its tool differently and uses a different field for deduplication. This table puts them in one place:

PlatformIn the browserFrom the serverDeduplicationTesting
MetaMeta PixelConversions APIeventID = event_id + same event name, within 48 hoursTest Events in Events Manager, and event match quality
SnapchatSnap PixelConversions APIclient_dedup_id = event_id within 48 hours; for purchases transaction_id = order_id up to 30 daysDeduplication diagnostics in Events Manager
TikTokTikTok PixelEvents APIevent_id on both sides + same event, within 48 hoursTikTok Events Manager
GoogleGoogle tagEnhanced conversions, with server-side GTM as an optionTransaction IDConversion diagnostics in Google Ads

Meta: Pixel with the Conversions API

  • Fire Purchase from the pixel with an eventID, and send the same event from the server with an event_id of the same value.
  • With the server event, send email and phone hashed, and client_ip_address, client_user_agent, fbp and fbc unhashed.
  • Send value and currency with the same values on both sides, such as SAR.
  • If you run Advantage+ campaigns, the quality of these signals directly shapes what the campaign learns.

Snapchat: Snap Pixel with the Conversions API

Snapchat has two deduplication methods, and many setups miss the second:

  • The general method: the pixel's client_dedup_id matches the Conversions API's event_id, within 48 hours.
  • For purchases only: the pixel's transaction_id matches order_id inside custom_data in the Conversions API, and works for up to 30 days.
  • Fixed placeholder values don't work for deduplication, so never send a constant string or a test value in place of the real ID.
  • value is required for PURCHASE. Pass sc_click_id from the ScCid URL parameter, and sc_cookie1 from the _scid cookie.

TikTok: TikTok Pixel with the Events API

  • TikTok requires an event_id in both the pixel and the Events API, and the same event name on both sides.
  • If the same event repeats from the same channel within 48 hours, TikTok keeps the first. If it arrives from both the pixel and the Events API, TikTok treats them as one event within the same window, and its documentation explains how it chooses between them based on when each arrives.
  • Turn on advanced matching, and send email and phone hashed with SHA-256.

Google: Google tag with enhanced conversions

Google works a little differently. There is no "pixel plus API" pair sharing an event ID as on the other platforms, but two tools serve the same goal:

  • Transaction ID: if you send the order number as the Transaction ID with the purchase conversion, Google Ads won't count a second conversion with the same ID. Its documentation notes that this doesn't resolve duplicates in view-through conversions.
  • Enhanced conversions: send customer data such as email, hashed with SHA-256, with the conversion to improve matching. You can turn it on from the Google tag or from Google Tag Manager.
  • Server-side GTM: an extra option where you run a Tag Manager container on a server in your own Google Cloud project or another environment, and route events to the platforms from there. It helps if you want to control the data from one place, but it needs setup and maintenance.

Testing and reading match quality

You test the pixel and server setup with a real test order, then confirm in each platform's events tool that the event arrived from both the browser and the server and counted once. The steps:

  1. Place a full test order from your phone and from a desktop browser.
  2. On Meta, open Test Events in Events Manager and check that the purchase arrived from both the browser and the server, and showed as one event after deduplication.
  3. On Snapchat, review the deduplication diagnostics in Events Manager.
  4. On TikTok, review the event in Events Manager and confirm the event_id arrives from both sides.
  5. In Google Ads, check the conversion status and the enhanced conversions diagnostics.
  6. Compare the value and currency on each platform with the order value in your store dashboard.
Deduplication diagram: a pixel event and a server event with the same event_id count as one order

On Meta, the Event Match Quality score shows for each event how well the platform can match it to account holders. If the score is low, start by checking that hashed email and phone, fbc and fbp reach your server events. Once measurement is right, you can read your return on ad spend knowing the numbers aren't doubled.

Consent and privacy

Connecting the pixel and server doesn't give you the right to send customer data without consent. The consent rules you apply to the pixel apply to server events too: if a shopper declines advertising cookies, don't send their personal data from the server. On Google, tie the setup to Consent Mode, and state clearly in your privacy policy what you send and to whom.

Salla, Zid and WooCommerce: what comes built in?

Before you build anything from scratch, check what your store platform offers:

  • Salla: the Salla Help Center explains connecting the Facebook Conversion API through an app, where you enter the Pixel ID and an Access Token. It also explains the Snap Business Extension, which connects the Snap Pixel, the catalog and the Conversions API in one step.
  • Zid: we found no official Zid documentation on connecting a Conversions API. Check the Zid app store and ask the developer of the app you use: does it send server events, and does it send the same event_id as the pixel?
  • WooCommerce: the official Meta for WooCommerce plugin covers the pixel and catalog sync. Check its settings to see whether the Conversions API is on, and if you add another tracking plugin, make sure the two don't send the same event twice.

The key question for any ready-made app: does it send the event from both the browser and the server with the same ID? If the answer isn't clear, test it yourself with a test order.

Common mistakes in the pixel and server setup

  • No event ID: the pixel and server both send the purchase, and every order counts twice.
  • A different ID on each side: each side generates its own number, so the platform can't link them.
  • A different event name: Purchase in the pixel and purchase_completed on the server, so they don't match.
  • Wrong value or currency: a value with shipping on one side and without it on the other, or a different currency. Keep one value and SAR on both sides.
  • Two apps sending the same event: the official store app and custom code at the same time.
  • Hashing what shouldn't be hashed: hashing the IP or fbp, or sending the email unhashed.
  • A phone number without the country code: weakens matching.
  • Trusting the numbers before testing: test after every change to the store or its apps.

Checklist

  • The pixel runs on every page, and the purchase event fires on the thank-you page only.
  • The purchase event is sent from the server to every platform you advertise on.
  • The same event_id and event name on both sides (and client_dedup_id or transaction_id on Snapchat).
  • A Transaction ID with the purchase conversion in Google Ads.
  • Email and phone hashed with SHA-256 after normalising, with the phone in 966 format.
  • IP, user agent, fbp, fbc, ScCid and _scid sent unhashed.
  • Value and currency match the store dashboard.
  • Server events respect the shopper's consent choice.
  • A test order shows as one event in each platform's test tool.

Frequently asked questions

Should I remove the pixel once I set up the Conversions API?

No. A hybrid setup means keeping the pixel and adding the server. The pixel captures on-page behaviour, the server makes sure key events arrive, and the event ID stops duplicates between them.

What is event_id and why does it matter?

It is a unique ID for each event, sent unchanged from both the pixel and the server. The platform uses it with the event name to know the two copies are one event. Without it, an order can count twice.

Do I have to hash all the data before sending it?

No. Personal data such as email and phone is hashed with SHA-256. The IP address, user agent, and cookie and click identifiers such as fbp and fbc are sent unhashed, according to Meta's and Snapchat's documentation.

Do I need server-side GTM to connect the pixel and server?

Not necessarily. Many stores connect through their store platform's app or directly from the store system. Server-side GTM is an option that gathers events in one container on your server, useful if you want more control and have someone to run it.

How do I know the setup works?

Place a test order, then check each platform's test tool to confirm the event arrived from both the browser and the server, counted once, and that the value and currency match the order in your store.

Conclusion

Connecting the pixel and server is more than installing an API. It is three things together: one event ID that stops duplicates, match keys that are complete and hashed correctly, and a test on every platform before you rely on the numbers. Start with the purchase event, then extend to the events before it. If you want someone to set up measurement and run it alongside your ads, see our digital advertising service.

Sources

  1. Meta for Developers — Conversions API
  2. Meta for Developers — Handling Duplicate Pixel and Conversions API Events
  3. Meta for Developers — Customer Information Parameters
  4. Meta Business Help Center — About event match quality
  5. Snap for Developers — Conversions API: Deduplication
  6. Snap for Developers — Conversions API: Parameters
  7. TikTok Ads Help — Event deduplication
  8. TikTok Ads Help — Advanced matching for web
  9. Google Ads Help — Use a transaction ID to minimize duplicate conversions
  10. Google Ads Help — About enhanced conversions
  11. Google for Developers — Introduction to server-side tagging
  12. Salla Help Center — Connect Facebook Conversion API
  13. Salla Help Center — Connect Snapchat (Snap Business Extension)
  14. WordPress.org — Meta for WooCommerce