DigiKeyword / Blog / Meta Conversions API: Avoiding Counting the Same Sale Twice with Pixel (event_id) and the n8n Flow

Meta Ads · Measurement · n8n

Meta Conversions API: Avoiding Counting the Same Sale Twice with Pixel (event_id) and the n8n Flow

When Pixel reports the same sale from the browser and Conversions API from the server, a single field makes Meta count them as one: event_id. Forgetting to set it up inflates your reports; setting it up wrong wastes the event.

If the number of orders in your ad account is higher than in your own dashboard, or conversely, if campaigns run blind because of sales Pixel misses, the problem is often that measurement comes from a single channel. Meta's solution, Conversions API, lets you send events from your server in addition to the browser. In this post, based on Meta's developer documentation, we explain how the two channels can work together without interfering, which fields should be hashed and which should not, and how to set it up in n8n. Sales tracking for WhatsApp ads is a separate flow; we covered it in our ctwa_clid post.

Short Answer

If you send the same event through both Pixel and Conversions API, give both the same event name and the same ID (eventID in Pixel, event_id in the API). Meta matches events by ID and name and deduplicates the copy that arrives within 48 hours. If you don't provide an ID, the same sale may appear as two separate events.

Why Isn't a Single Channel Enough?

The Pixel runs in the browser. If the user has blocked cookies, uses an ad blocker, or closes the page before the payment completes, the event may never reach Meta. On the server side, the order is already recorded: when the payment is confirmed, your system knows about the event. The Conversions API carries this information directly from the server to Meta.

The server alone isn't ideal either, because context from the browser (cookie ID, page behavior) can be lost. That is why many setups use both together. The price is reporting the same sale through two channels and making sure it is counted as a single event.

How Does Deduplication Work?

According to Meta's documentation, events are treated as the same based on ID and name. The eventID in the Pixel event must match the event_id in the API event, and the event in the Pixel must match the event_name in the API. If either side differs, Meta counts them as separate events.

Two details are often overlooked:

The documentation also mentions an alternative: matching with fbp and/or external_id instead of event_id. This method generally works only when the browser event arrives first and the server event second. Meta also states that no deduplication takes place if only a single source is used (browser only or server only). In other words, if you use only the API without ever installing the Pixel, this topic doesn't concern you.

What Should You Use as the event_id?

The documentation doesn't recommend a format in this section; what matters is that both sides can produce the same value. In a store with order data, a string that appends the event name to the order number does the job (for example, the order's ID combined with the word Purchase). The thank-you page already knows the order, and so does the server. In a form-based business, the form's record ID plays the same role.

If you're going to use a randomly generated value, you need to generate it on the page first and pass it to both the Pixel call and the server (via a hidden form field or the order record). If the server generates a different random value on its own, there will be no match.

Which Fields Are Hashed and Which Aren't?

Meta's customer information parameters page says the following:

Normalization before hashing is essential. For email, leading and trailing spaces are removed and all letters are lowercased. For phone numbers, symbols, letters and leading zeros are dropped, and the country code must be included. For a Turkish number, this means sending the format that starts with the country code, not the local format starting with 0. If you skip normalization, your hash won't match the one on Meta's side and matching will fail. We discussed what hashing means from a KVKK perspective in our article on Google Ads enhanced conversions; the same logic applies here.

The Flow with n8n

The flow below is a structure we recommend; it's a design derived from Meta's documentation examples, not a ready-made template.

1. Trigger. When a payment confirmation or form submission arrives, a webhook or a store node starts the flow. If you use a webhook, don't forget to verify the source of the incoming request; our signature verification article written for WhatsApp explains the same idea.

2. Preparation. In a Code node, normalize the email and phone and hash them with SHA-256, derive the event_id from the order ID, and write event_time as the event's actual Unix time (in seconds).

3. Sending. An HTTP Request node sends a POST to Meta's endpoint. The format in the documentation is: https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events, and the access token is passed with the access_token parameter. For web events, the action_source value is website. Keep the token in n8n's credentials field and do not write it in plain text inside the workflow.

4. Errors and retries. If you add retries, keep the same event_id; generating a new ID breaks deduplication.

Before Going Live: Testing and Timestamp

When you select your Pixel under Data Sources in Events Manager and open the Test Events tab, a test code is generated. You send it in the test_event_code field. Meta's warning is clear: the code is for testing only and must be removed from production requests. Moreover, events sent with a test code are not dropped; they are processed. So if you forget the code, test data mixes with real data.

The rule for event_time is this: events are accepted up to a maximum of 7 days before the moment they are sent. If even a single event in the request is older than 7 days, Meta rejects the entire request with an error. That is why separating old records matters in a flow that sends in batches. Do not confuse the 7 days in the documentation with the 48 hours in deduplication: one is the acceptance window for an event, the other is the matching window for duplicates.

Common Mistakes

There are four mistakes that follow directly from the rules in the documentation. The first is writing the event name differently on the two sides: for example Purchase in the Pixel and lowercase purchase on the server. Because Meta also looks at the name when matching, these two events are not deduplicated; write them exactly the same. The second is generating event_id separately on the server and in the browser. The third is hashing the IP address or the fbp value; Meta wants these sent raw. The fourth is hashing an email without lowercasing it, or a phone number without writing it with the country code.

For verification, the fastest way is to see the event coming from both the browser and the server at the same time on the Test Events screen. If the IDs of the two events are the same on the screen, the setup is on the right track; if they differ, first check the event name and event_id. It also saves time to place a real test order before going live and confirm that the report shows a single sale.

KVKK and Consent

Sending the hash of an email or phone number from the server to Meta means transferring data to a platform abroad. Hashing alone does not resolve this issue. Your privacy notice must include this transfer, and on the cookie consent side, use for advertising purposes must be selectable. Clarify the matter with a legal advisor; we explained the relationship between cookie consent and measurement in our Consent Mode v2 article.

FAQ

Do I have to use Pixel and the Conversions API together?

It is not mandatory. Meta's documentation describes using the two sources together (redundantly) along with deduplication methods. If no deduplication key is provided, the same sale may be counted twice.

Where do I generate the event_id?

Use a value that identifies the order and that both sides can access; for example, a string made up of the order number and the event name. It is enough for the same value to go into the Pixel's eventID field and the API's event_id field.

What happens if I keep sending test events to the live environment?

Meta says that events containing test_event_code are not dropped but processed. That is why you must remove the code from production requests.

Sources: Meta for Developers, "Handling Duplicate Pixel and Conversions API Events", "Customer Information Parameters" and "Using the Conversions API". Time limits, field names and rules are reported as they stood on the date this article was written; Meta may update them.

Why doesn't the order count in the ad report match?

Let's review your Pixel and server events together and check whether there is double counting or missing events.

Book an Appointment Message on WhatsApp

Related posts