The sale arrives without the click
The sale webhook only carries the origin if the click id made it all the way to checkout. A free-text parameter, UTM or coupon in place of the click id attributes nothing.
Middleware that connects the checkout, RedTrack and Meta. Every sale becomes a conversion attributed to the right click, exactly once, even with duplicated or out-of-order webhooks or a destination that is down.
LAB environment running 24/7 · flow validated with real test purchases
The sales platform knows someone bought. RedTrack knows which ad the click came from. When the bridge between them fails, the ad manager optimizes on wrong data and nobody notices right away.
The sale webhook only carries the origin if the click id made it all the way to checkout. A free-text parameter, UTM or coupon in place of the click id attributes nothing.
Ad blockers, browser tracking protection or a tab closed before the pixel fires. If the purchase depends on the browser, part of it disappears.
The platform redelivers the same event when it gets no answer. Without protection, one sale becomes two conversions and the ad looks more profitable than it is.
Each funnel step is its own transaction. If everything goes out as one purchase, or with the same key, bump and upsell revenue either vanishes or is counted as a new sale.
RedTrack records a refund as a separate conversion and does not remove it from the original sale. Without your own math, the dashboard shows gross revenue as if it were net.
A subscription renewal is revenue, but not a new sale for the ad. An offer launched without a mapping arrives with no type and lands in the wrong place, or nowhere.
From the ad click to the conversion event on Meta. Each color is a platform; steps marked "This project" are own code.
The RedTrack tracking domain records the click and generates a 24-character click id.
Own script reads the click id (query and cookies), fires InitiateCheckout and video milestones (play, 1, 3, 5 and 10 min) with deduplication. A network failure never blocks the checkout.
The click id travels in the checkout platform origin parameters up to the purchase. Hotmart is the integration that is ready today.
Token compared in constant time, schema validated with Zod, personal data redacted, event classified and stored idempotently before anything is sent.
Conversion sent to RedTrack with value, type and transaction id. Timeout, network errors, 429 and 5xx go to retry with exponential backoff. 4xx errors are not retried.
RedTrack forwards the event to Meta. Purchase, order bump and upsell arrive as distinct purchases, one per transaction, without one erasing another in deduplication.
The same flow as this page, from the ad click to the event on Meta, drawn as a mind map and explained one branch at a time.
The path of a sale, from the click to Meta, in about 8 minutes: I read the summary map block by block, in the same order.
Narration in Portuguese. The file is only downloaded when you press play.
The full map has restricted access. The video above shows the summary; to see every detail, get in touch.
Every event has a classification rule, a destination and a key against duplicates. What should not become a conversion is stored, but not sent.
| Event | How it is identified | RedTrack | Meta (via RedTrack) | Duplicate key |
|---|---|---|---|---|
| Browser | ||||
| InitiateCheckoutValidated end to end | Click on the page buy button, fired by the own script. | InitiateCheckoutOn the page click id | InitiateCheckoutStandard event | click id + type, once per session |
| Video milestonesValidated end to end | Play and 1, 3, 5 and 10 minutes watched on the VSL. | One type per milestone | Not sent, on purpose: too granular a signal to optimize on | click id + type, once per session |
| Sale | ||||
| PurchaseValidated end to end | Approved purchase of an offer mapped as main product, on the first charge. | PurchaseValue and transaction id | PurchaseOne per transaction | event id + transaction/event pair |
| Order bumpValidated end to end | By the offer code, not by the bump flag in the payload. | orderbumpIts own transaction | PurchaseA distinct purchase | event id + transaction/event pair |
| UpsellValidated end to end | By the offer code. | upsellIts own transaction | PurchaseA distinct purchase | event id + transaction/event pair |
| DownsellNo real transaction yet | By the offer code. | downsellIts own transaction | Defined during setup | event id + transaction/event pair |
| Reversal | ||||
| Refund | Refund event, for any offer. Does not depend on a mapping. | refundedNew conversion on the same click, with the original value | refundedCustom event | event id + transaction/event pair |
| ChargebackNo real transaction yet | Chargeback event, for any offer. | chargebackNew conversion on the same click | chargebackCustom event | event id + transaction/event pair |
| Stored, not sent | ||||
| Renewal | Approved purchase with a recurrence number above 1. For a subscription missing that number, it is fetched from the payments API. | Not sent | Not sent | event id + transaction/event pair |
| Cancellation, delay, overdue | Subscription lifecycle events. | Not sent | Not sent | event id + transaction/event pair |
| Unknown offer | Offer code with no mapping. Never becomes a purchase by default. | Stays in the panel until mapped; then preview and reprocess | Not sent | event id + transaction/event pair |
InitiateCheckout
Validated end to endClick on the page buy button, fired by the own script.
InitiateCheckoutOn the page click idInitiateCheckoutStandard eventVideo milestones
Validated end to endPlay and 1, 3, 5 and 10 minutes watched on the VSL.
Purchase
Validated end to endApproved purchase of an offer mapped as main product, on the first charge.
PurchaseValue and transaction idPurchaseOne per transactionOrder bump
Validated end to endBy the offer code, not by the bump flag in the payload.
orderbumpIts own transactionPurchaseA distinct purchaseUpsell
Validated end to endBy the offer code.
upsellIts own transactionPurchaseA distinct purchaseDownsell
No real transaction yetBy the offer code.
downsellIts own transactionRefund
Refund event, for any offer. Does not depend on a mapping.
refundedNew conversion on the same click, with the original valuerefundedCustom eventChargeback
No real transaction yetChargeback event, for any offer.
chargebackNew conversion on the same clickchargebackCustom eventRenewal
Approved purchase with a recurrence number above 1. For a subscription missing that number, it is fetched from the payments API.
Cancellation, delay, overdue
Subscription lifecycle events.
Unknown offer
Offer code with no mapping. Never becomes a purchase by default.
The happy path is the solid line. Dashed boxes show what happens when something goes wrong, and where each case shows up for the operator.
Retry in detail: by default up to 3 attempts per send, an 8 second timeout and a wait that doubles from 500 ms. Only timeouts or network errors, 429 and 5xx are retried. If the send fails, the webhook answers 502; when the checkout platform redelivers the same event, the send is redone on the same row, without duplicating.
Event id as primary key and a unique transaction + event pair. Duplicates go to their own table. Redelivery of a failed event retries the send without creating a new row.
Purchase, order bump, upsell, downsell, renewal, refund, chargeback, cancellation, delay, overdue and unknown. A renewal counts as revenue and is not sent as a new conversion.
Only 24 hexadecimal characters count. The preferred parameter comes first, the other is the fallback, and free text is kept as received without becoming attribution.
When recurrence data is missing, the backend queries the platform payments API after answering the webhook. The merge only fills empty fields, divergence becomes a conflict for review.
CRUD with optimistic locking, an append-only audit trail and an in-memory snapshot that fails closed on boot. Rollback by feature flag, no destructive migration.
An event already sent is never resent or reclassified automatically. A mapping change after the send becomes a visible conflict in the panel, with a preview before reprocessing.
Gross, renewals, refunds, chargebacks and net computed from events. A refund and a chargeback on the same transaction subtract only once. With incomplete history, net stays null instead of an invented zero.
Health and readiness, duplicate and retry counters that survive restarts, and alerts for backlog, failure rate, old pending events and missing webhooks, exposed in the operations summary API. Additive, idempotent migrations.
The checkout platform is the financial truth, the database is the operational truth, RedTrack owns attribution and Meta only optimization.
The volume does not justify it. Retry and enrichment run in the same process, on a single instance, and the checkout platform redelivery works as a second chance. The limit of this choice is documented.
The page click receives engagement events. The checkout click receives the purchase. Keeping them apart avoids attributing a sale to the wrong event.
The backend does not call the Conversions API directly. A single delivery path lowers the risk of duplicated events on Meta.
A refund does not edit the original purchase: it goes in as another type on the same click. The history of a sale approved and then returned is preserved, and refund rate becomes its own metric.
The panel can ask a model for a mapping suggestion for an unknown offer. The suggestion never writes anything. Delivery stays deterministic.
Automated tests with Vitest, unit and HTTP integration, with no external network: an ephemeral database and a mocked RedTrack. Deploys run typecheck and the tests before the build and migrations.
A duplicate is never stored twice, approval and refund of one transaction are two rows, a renewal never reaches RedTrack, 5xx is retried and 4xx is not.
CRUD with expected version, audit, Postgres and SQLite drivers, a snapshot that refuses invalid rows and a boot that aborts if the database is unreachable.
Rate-limited login, expired sessions, CSRF required on mutations, security headers and pages that never contain the token.
Lookup only after the response, a merge that only fills blanks, conflicts without overwriting and sending blocked while recurrence is pending.
Fixtures kept out of real finance and a reversal without the original sale leaving net null.
No mapping returns 409, reprocessing twice sends once, a sent event is never reinterpreted and the preview changes nothing.
A double click does not duplicate the send, each video milestone fires once and a failure or timeout still leads to checkout.
Postgres transactions, a readiness check that answers 503 without leaking driver errors, and the suggestion model client.
Interface in HTML, CSS and ES modules served by the backend itself, no framework and no bundler. Five screens: overview, events, offers, unknown offers and enrichment. The screens below use synthetic data.

I set up and maintain this platform for operations that run on RedTrack. The base is ready: the work is connecting your funnel, mapping your offers and validating with a test purchase before switching over.
Page, VSL, checkout, offers, order bumps and upsells, traffic sources and whatever pixel and Conversions API setup already exists.
For every event in your funnel: whether it exists, whether it counts in finance, whether it goes to RedTrack and to Meta. Only with your confirmation or a real payload.
Invites in the official panels, always with the lowest permission needed. No password or token over chat.
Tracking domain, webhook, offers and the page script. DNS or webhook changes only with the exact record confirmed and the rollback defined beforehand.
A real test purchase goes through the whole funnel. It only goes live after every point below is checked.
Monitoring the panel and adjusting as the funnel changes.
I currently maintain RedTrack tracking for one client in operation. The platform was validated end to end with real test purchases, and every new setup gets close follow-up. Pricing is discussed privately, after the review.
Talk about a setupThe second delivery gets a 200, is logged in a duplicates table and nothing is resent to RedTrack. The key is the event id plus the transaction and event type pair. The exception is on purpose: if the first send had failed, the redelivery redoes the send on the same row.
Timeouts, network errors, 429 and 5xx errors are retried with growing waits. If it still fails, the event is stored as failed, shows up in the panel and can be resent manually by the operator, through an operations API endpoint. The checkout platform redelivery also redoes the send. Nothing is lost silently.
Hotmart is the integration that is ready today. Classification, idempotency and delivery work on an internal event model, so another checkout platform comes in as a new webhook adapter. That is assessed case by case, before agreeing.
No. The platform was built for RedTrack. Your account, campaigns and reports stay where they are; what changes is that sales start reaching it reliably.
It does not, and that is how RedTrack itself works: the refund comes in as another conversion on the same click, with the original value. Native ROAS stays gross. Net is computed in the panel, which subtracts refund and chargeback once per transaction.
In a Postgres database that belongs to the setup. The platform is not multi-tenant, so there is no database shared with other operations. Buyer name, email, phone, document and address are redacted before storage.
Access is by invite in the official panels, with the lowest permission that works, and you can revoke it at any time. API credentials go straight into the server environment variables, never over chat. DNS changes only with the exact record and rollback agreed beforehand.
Access to RedTrack and to the product on the checkout platform, the Meta pixel or dataset in use, one DNS record, the list of offers with their codes and the contact of whoever approves changes.
A new offer is mapped in the panel, with a change history. Unknown offers and failed sends show up in the panel and are handled one by one, with a preview before reprocessing. Alerts live in the operations summary API. When checkout and RedTrack diverge, reconciliation shows where.
It depends on the funnel: how many offers, whether there are subscriptions, a VSL, which checkout. Pricing is agreed privately, after the review.
Tell me what your funnel looks like. I will reply with what it takes to set it up and what stays out of scope.
Useful to include
Independent project. Not affiliated with or endorsed by RedTrack, Hotmart or Meta. Names and trademarks belong to their owners.