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:status | HTTP | Meaning |
|---|---|---|
recorded | 201 | A new conversion was attributed and a form submission created |
duplicate | 200 | This click already converted — nothing new was recorded |
ignored | 200 | The click token was missing, invalid, or expired |
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.
API reference
Record an affiliate conversion
POST /api/v1/affiliate/conversions