← All guides

Track affiliate sales on headless Shopify (Hydrogen) with an API

June 5, 2026 · 6 min read

Most affiliate apps track sales with a discount code or a checkout pixel. On a headless storefront (Shopify Hydrogen, a custom React app, or a separate frontend) that flow can break — your frontend isn't the one Shopify renders, and you may run a custom checkout. The fix is a server-to-server conversion API: your backend tells the affiliate platform about each sale, with the affiliate it should be credited to.

How attribution normally works

An affiliate shares a link (carrying a referral code) and/or a unique discount code. A click sets a cookie; a checkout with the code, or a last-click pixel, attributes the order. On a standard Shopify storefront this is automatic. Headless adds a wrinkle: you control the storefront and sometimes the checkout, so you want to report conversions explicitly rather than rely on the storefront pixel alone.

The conversion API approach

Capture the affiliate's referral code on landing (from the URL, e.g. ?ref=JANE) and persist it for the session. When an order is paid, your backend POSTs the sale to the affiliate platform with the order id, amount, and that referral code. The platform attributes it and computes commissions across your tiers. It's idempotent by order id, so retries are safe, and it never needs customer PII.

Example

With Override, that's a single authenticated request:

  • POST /api/v1/conversions with { orderId, amount, currency, ref }
  • Optionally include a customerId (hashed, never stored) so repeat orders can recur to the original affiliate.
  • Authenticate with a bearer API key created in the app.

Webhooks for the other direction

Use outbound webhooks to push affiliate events into your own systems — a new affiliate to your CRM, a conversion to your data warehouse, a payout to Slack. Payloads are signed (HMAC-SHA256) so you can verify them. Together, the conversion API plus webhooks let you run a full affiliate program on any stack, not just a standard Shopify theme.

Do it with Override

Override's developer API (REST + webhooks + headless conversion ingest) is included on the Scale plan, with full docs and examples. It's the same engine that powers the native Shopify integration — so headless stores get multi-tier overrides, recurring commissions, bonuses and fraud protection, just driven by your backend.

Launch your affiliate program with Override

Flat-fee, multi-tier, compliant — live in minutes with a Quick Start checklist and industry templates.

Scroll for more →

Override — the flat-fee multi-tier affiliate app for Shopify: never a % of your sales, flat fee from $19/moOverride dashboard with affiliate revenue, conversions and earnings chartUp to 10 commission tiers — the deepest multi-tier on ShopifyCouponLeak Guard flagging discount-code orders used without a referral clickRecurring commissions — earn on every repeat orderMilestone bonuses and performance auto-tiersAdvanced analytics: conversion rate, AOV, EPC and attribution sourcesFlexible payouts: PayPal, store credit and bank/WiseBranded affiliate portal with a gamified leaderboardAffiliate broadcasts — email your whole roster, personalizedMulti-campaign tracking with per-campaign linksSwipe-copy asset library with banners and ready-to-paste copyQuick Start checklist and industry templatesDeveloper API, headless conversion tracking and signed webhooks

Keep reading

Guides on running a compliant affiliate program on Shopify.

How to set up an affiliate program on Shopify (2026 step-by-step)

A practical 2026 guide to launching an affiliate program on Shopify: commission structure, attribution, recruiting affiliates, payouts and staying compliant.

Read guide →

Is multi-tier affiliate marketing legal, or is it an MLM?

Multi-tier affiliate programs are legal when they pay on real sales and cap tier depth. Here's the line between affiliate marketing and an illegal MLM/pyramid scheme.

Read guide →

Flat-fee vs revenue-share affiliate apps: what they really cost

Revenue-share affiliate apps take a percentage of every referred sale, so the bill grows as you scale. Here's the real cost vs a flat monthly fee.

Read guide →

Affiliate commission rates by industry (2026 benchmarks)

Typical affiliate commission rates for beauty, supplements, fashion, digital products and creator brands — with sensible multi-tier structures to copy.

Read guide →

Track affiliate sales on headless Shopify (Hydrogen) with an API

Headless and custom storefronts break normal affiliate tracking. Here's how to attribute affiliate sales server-to-server with a conversion API — and sync events with webhooks.

Read guide →

Recurring affiliate commissions: pay affiliates for repeat orders

Recurring commissions reward affiliates when the customers they referred buy again — ideal for subscriptions and repeat-purchase brands. Here's how they work, compliantly and without storing PII.

Read guide →

How to stop affiliate discount codes leaking to coupon sites

Affiliate codes end up on coupon aggregators, and you pay commission on sales you'd have made anyway. Here's how to detect leaked-code abuse and stop paying for it.

Read guide →

How to recruit your first affiliates for a Shopify store

Practical, proven ways to recruit affiliates for a Shopify store — starting with your own customers, an on-site block, an invite email, and a portal that converts.

Read guide →