How It Works
The tracking + attribution flow,
end to end.
We use last-click attribution with a 30-day cookie window — the industry standard Impact / CJ / Rakuten use. Below is the full technical flow from click to payout.
1
Publisher shares a tracking link
After being approved for a brand's program, the publisher gets a unique URL like
https://pandacps.com/go/my-slug-abc. The /go/{slug} path is served by a Cloudflare Worker deployed to pandacps.com.2
User clicks → PandaCPS worker handles redirect
When a user clicks the link, the Cloudflare Worker:
- Looks up the (program × publisher) record by the slug
- Validates that both the program and the publisher-approval status are active
- Generates a
click_id(UUID) — the same value is used for the database primary key, the browser cookie, and the URL parameter - Async-inserts a
pc_click_eventsrow with IP hash, user-agent, country, referrer, UTM params (non-blocking — user doesn't wait) - Sets the cookie
pcps_click={click_id}; Domain=.pandacps.com; Max-Age=2592000; HttpOnly; Secure; SameSite=Lax - 302 redirects to the brand's
dest_urlwith?pcps_click={click_id}appended
3
User lands on brand site → captures click_id
The brand's server-side code reads
?pcps_click from the landing URL and stores it in the user's session / cookie / checkout state until conversion. Frontend frameworks: read from new URL(window.location).searchParams.get(“pcps_click”). Shopify/WooCommerce/custom backends: persist via cart/session middleware.4
User converts (buys, signs up, files form)
Brand records the sale / signup in their own order system with their internal order reference. The pcps_click captured in step 3 travels with the order.
5
Brand sends server postback to /api/conv
Brand's server makes an authenticated POST to
https://pandacps.com/api/conv:POST https://pandacps.com/api/conv
Authorization: Bearer pc_live_abc123... (brand API key)
Content-Type: application/json
{
"program_id": "uuid-of-program",
"brand_order_ref": "ORDER-2026-0001",
"order_value": 99.00,
"order_currency": "USD",
"pcps_click": "uuid-from-landing-url"
}Idempotent: same (program_id, brand_order_ref) pair returns "duplicate" without double-counting.6
PandaCPS attributes + calculates commission
Worker validates the API key → matches brand → confirms program belongs to brand → calls attribution engine:
- Find last
pc_click_eventsrow wherecookie_id = pcps_click, matching program, within the program'scookie_window_days(default 30) - If found → credit to that click's publisher_id
- If not found → conversion inserted as “unattributed”
- Commission calc: flat_cpa →
program.commission_value; percentage →order_value × rate / 100 - Network fee = commission ×
network_fee_pct / 100(default 20%) - Publisher payout = commission − network fee. Stored as pre-computed columns in
pc_conversions
7
Conversion appears in real-time dashboards
Supabase Realtime streams the INSERT event to:
- Brand dashboard — /dashboard/brand/conversions/ — sees all their programs' conversions
- Attributed publisher's dashboard — /dashboard/publisher/earnings/ — sees just their credited conversions
- Admin review queue — /admin/conversions/ — approves pending, reverses fraud
8
Monthly settlement
On the 1st of each month, approved conversions from the prior month roll into:
- Publisher payouts — aggregated per publisher, paid by their chosen method (ACH / Wise / PayPal / USDT / WeChat Pay / Zelle) on the 15th
- Brand invoices — PDF invoice for gross commission + 20% network fee, Net 30 payment terms, USD wire or ACH
Attribution rules
- Last-click wins within cookie window. If a user clicks publisher A's link day 1, then publisher B's on day 3, then converts day 5 → publisher B gets credit (30-day default window; brand-configurable per program).
- Unattributed conversions still recorded. If the brand postback arrives without a matching cookie (user cleared cookies / ad-blocker stripped the URL param / conversion outside 30-day window), the conversion is inserted with publisher_id=null. Network fee still applies; no publisher payout.
- Deduplication. A brand cannot double-charge via the same
brand_order_reffor the same program. Second postback returnsstatus: duplicate. - Reversals. Brand or admin can reverse a conversion within 30 days of insert (for refunds, chargebacks, fraud). Reversed conversions don't pay out.
Ready to start?