Open this page with ad params, e.g.
?rm_aid=AD_123&utm_source=facebook.
A pageview fires on load. Then identify + fire an event; a server webhook (curl below) will attach a purchase to this session by email.
Then, server-side (revenue source of truth):
curl -X POST http://localhost:8787/v1/webhook/custom/demo-funnel \
-H 'x-api-key: mx_demo_key' -H 'content-type: application/json' \
-d '{"event":"purchase","email":"buyer@example.com","amount":497,"currency":"EUR","order_id":"ord_1"}'
Check /v1/_debug/state — the purchase carries the ad_id from this session.