How attribution works
OpenPartner is event-sourced. The raw layers are immutable; attribution is a derived view you can re-run at any time without re-collecting data.
The chain
click → identity → event → attribution → commission → payout(raw) (derived) (raw) (derived) (derived) (ledger)Click
When a user hits a partner link (e.g. https://yourdomain.com/r/abc123), the click router:
- Parses the partner ref out of the URL or
?ref=param. - Records a
Clickrow (immutable): partner ID, campaign, landing URL, IP hash, UA, referer. - Drops a first-party cookie (
op_cref) scoped to the customer’s domain. - Redirects to the destination URL.
The cookie is first-party — it survives Safari ITP because the SDK can read and refresh it on the customer’s own domain.
Identity
When the customer’s app calls op.identify(userId, ...), OpenPartner writes an Identity row
linking that user to the click ref in their cookie. Identity is the bridge that lets us
attribute revenue to a click that happened weeks earlier — even on a different device, as long
as the same logged-in user is involved.
Event
Revenue events (subscription_created, invoice_paid, etc.) are written via op.event().
They reference the userId, which chains back through Identity → Click.
Attribution
The attribution engine walks Event → Identity → Click and applies the configured model:
- last_click (default) — credit the most recent click within the lookback window
- first_click — credit the first click in the chain
- linear — split credit equally across all qualifying clicks
- position — 40% first / 40% last / 20% middle
The result is an Attribution row that’s a derived view — re-runnable from raw data.
Commission and payout
Commissions are computed from Attribution + the merchant’s program rules (flat rate, percent of revenue, custom). They land in pending review, get approved, then settle on the next payout cycle through Stripe Connect.
Why event-sourcing matters
You can change attribution models retroactively. You can re-run with a different lookback window. You can audit any commission back to the raw click that drove it. And when you export your data, you export the raw layers — meaning the receiving system can re-derive everything, with no fidelity loss.