PandaCPS
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_events row 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_url with ?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_events row where cookie_id = pcps_click, matching program, within the program's cookie_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
Row-level security (RLS) on Postgres enforces tenant isolation — a brand can never see another brand's data.
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
Payouts gated by brand invoice status — if the brand hasn't paid, we hold the publisher payout until collected. Publisher is notified; we reach out to the brand.

Attribution rules

Ready to start?