Signed server events: stopping fake and spammed conversions

Updated · 6 min read

Short answer

An open conversion endpoint accepts any request that looks right, so bots, scrapers and copied scripts can inject fake purchases that skew reports and bidding. Signing fixes that. Your backend computes an HMAC of each event with a secret key that never leaves the server, the receiver recomputes it, and anything unsigned, altered, stale or replayed is rejected.

If your conversion data can be written by anyone who opens the browser's developer tools, it eventually will be. Sometimes it is a bot, sometimes a competitor's scraper, sometimes your own staging site posting to production. The result is the same: conversions that never happened, feeding reports you make budget decisions from and algorithms that bid on them. Signed events close that door. This post explains why open endpoints attract abuse and how a signature works, in plain terms.

Why an open tracking endpoint gets abused

Many setups send conversions like this: the confirmation page runs a script, the script posts {"event":"purchase","value":89.95} to an endpoint such as /api/track, and the endpoint forwards it to an ad platform or writes it to a database. Everything the endpoint needs is visible in the page source. Anyone can copy the request and send it again from a terminal, with any value they like.

That is not a theoretical risk. Abuse tends to come from a few sources:

Fake conversions do two kinds of damage. Your reports overstate results, and any bidding algorithm receiving them starts finding more of the audiences that "converted," which are now partly bots.

What a signature proves

A signed event carries a short code computed from the event's contents and a secret key. The most common method is HMAC with SHA-256. In plain words:

  1. Your backend and the receiving system share a secret key, a long random string stored only on servers.
  2. When your backend creates an event, it takes the exact bytes of the event body, plus a timestamp, and runs them through HMAC with the secret. Out comes a fixed-length code, the signature.
  3. It sends the event with the timestamp and signature in headers.
  4. The receiver, which knows the same secret, runs the same calculation on what it received. If its result matches the signature, the event came from someone holding the key, and nothing in it was changed on the way.

Change one character of the body, such as the value from 89.95 to 899.95, and the signature no longer matches. Without the key, nobody can produce a valid signature for a new event. That is why the key must never appear in browser code: once it is in a page, anyone can sign anything.

A concrete signed payload

Here is the shape of a signed purchase event. The header names are illustrative; use whatever your receiving system documents.

POST /events
X-Timestamp: 1793790000
X-Signature: 4be1f0c9...e27a

{"event":"order_paid","event_id":"ord_58213","value":64.95,"currency":"AUD"}

The backend computed the signature as HMAC-SHA256 of the string 1793790000. followed by the exact JSON body, using the shared secret. The receiver does four checks, in this order:

  1. Recompute and compare the signature using a constant-time comparison, so timing cannot leak how much of the signature matched.
  2. Check freshness. Reject the event if the timestamp is more than a few minutes old. Including the timestamp in the signed string stops an attacker from attaching an old signature to a new time.
  3. Reject repeats. Store event_id values for at least the freshness window and drop any ID already seen. A captured valid request sent again is a replay; this check catches it.
  4. Validate the content. Value is a number within a sensible range, currency is one you sell in, event name is on your list.

Only then is the event accepted and forwarded.

Worked example: a kids educational toy brand in Perth

Say an educational toy brand sells coding robots and puzzle kits, with an average order around AUD 65. Its confirmation page posted purchases to an open endpoint, which relayed them to its ad platforms as server events. One month the endpoint logged 1,460 purchases. The store had 1,012 paid orders.

That is 448 phantom purchases, inflating the endpoint's purchase count by 44%. Looking at the log:

At an average of AUD 65, the 448 phantoms represented about AUD 29,120 of revenue that did not exist, reported to ad platforms as real.

The fix was to stop accepting purchases from the browser at all. The store's order system now creates a signed order_paid event when payment clears, using the order number as event_id. The browser still fires its pixel for matching purposes, deduplicated against the server event, but the server event is the only one that writes to the conversion log. The following month the log showed 1,031 events against 1,031 paid orders.

What signing does not protect against

Signing proves origin and integrity. It does not prove the purchase was good. A real order paid with a stolen card is correctly signed, and so is an order later refunded. Those need fraud checks and refund adjustments, which is a separate job covered in refunds and chargebacks in ROAS.

It also does not fix bugs in your own backend. If your order system signs the wrong value, the receiver will faithfully accept the wrong value. Validate the content at the source, too.

Rolling it out

If you report conversions into Adtrix from your backend, it supports signed server events for exactly this reason. For platform-side server APIs, the same principle applies to their access tokens: they belong on the server. Background on the server route itself is in server-side ad tracking explained and the Meta Conversions API explained, and pairing the signed server event with its browser twin is covered in deduplicating browser and server conversion events.

FAQ

Can I sign events in the browser with an obfuscated key?

No. Anything the browser can read, a determined person can extract. Signing only helps when the key stays on servers you control.

Is an API key in the request header enough instead of a signature?

A static key proves the sender knows the key but does not protect the body from being altered or replayed if the request is captured. A signature with a timestamp and event ID covers both.

How long should the freshness window be?

A few minutes is typical. It needs to cover clock drift and normal network delay, but short enough that a captured request is useless soon after.

Does signing slow down event delivery?

Computing an HMAC takes a negligible amount of time on any modern server. The cost is in the setup and key management, not the speed.

See your own numbers with the source attached

Adtrix connects Meta and Google Ads read-only, shows each ad next to its spend and reported results, and keeps CRM leads and booked calls in their own lane.

Start a 14-day trial See pricing