affiliate.js snippet.
How attribution works
- A partner shares an Introw affiliate link (
/r/{code}). Introw logs a server-side click and redirects the visitor to your site with an opaqueirw_idquery param. - The
affiliate.jssnippet on your site readsirw_id, stores it in a first-party, last-click_introw_affcookie (90-day window), and strips it from the URL. - When the visitor converts (signup, purchase, …), you call the conversions endpoint with the cookie value as
clickId. - Introw verifies the signed click token, deduplicates, and creates a campaign form submission from the conversion payload.
Forgiving responses
The browser snippet must never surface errors on your page, so the endpoint is intentionally lenient:Choose an integration
Option A - Client-side (browser)
Add the snippet once in the<head> of every page. It stores the attribution cookie, auto-tracks HubSpot form submissions, and exposes window.introw.affiliate.track(...). The organisation publishable key is safe to expose and the same for every campaign - the visitor’s click cookie decides which campaign a conversion belongs to, so one snippet covers all your campaigns. Find your key on any campaign’s Install tab.
track when a visitor converts. You don’t need to pass a key - the snippet’s organisation key is used automatically, and the visitor’s click cookie decides which campaign the conversion belongs to:
HubSpot forms
Once the snippet is installed, HubSpot form submissions are tracked automatically - no embed-code changes and notrack call. The snippet listens for both classic (hsFormCallback postMessage) and HubSpot Forms v4 (hs-form-event:*) submit events, reads the submitted email, and records the conversion against the visitor’s click cookie.
Option B - Server-to-server
Recommended when conversions happen on your backend. Use a secret API key with theaffiliate:write scope and send the click id captured from the _introw_aff cookie:
Conversion properties
Send arbitrary metadata inproperties (for example plan, deal value, or order id). Each key is mapped onto a campaign form field via the campaign’s field mapping; unmapped keys are stored alongside the submission.
Authentication
The server-to-server path uses a secret API key with theaffiliate:write scope - see Authentication. The browser path authenticates with the campaign publishable key plus the Origin allowlist instead of a secret key.
Migrating from another tool
If you’re moving from a previous affiliate tool (for example PartnerStack), Introw can recreate your program as campaigns and generate an affiliate link for every partner. So links already in the wild keep working, each old link is mapped to its new Introw link. Add a redirect rule on your side that forwards old links to the backwards-compatible redirect endpoint (pass the original URL as theu query parameter). Introw resolves the mapping and redirects
to the new Introw link, which records the click and forwards to the destination as usual. No API key is
required - the lookup is keyed by the original URL.
API reference
Record an affiliate conversion
POST /api/v1/affiliate/conversions
Redirect a legacy (PartnerStack) link
GET /api/v1/affiliate/legacy-redirect