Tracking script

Tracking script reference

Reference for sdk.js: attributes, URL parameters, the pp_attr cookie, intrio.track and every response.

Available on every plan.

Install
<script src="https://intrio.co/sdk.js" data-key="pk_your_publishable_key" async></script>
<script>window.intrio=window.intrio||{q:[],track:function(){this.q.push(arguments)}}</script>

The second line is a stub that queues intrio.track calls made before the script loads. Queued calls are sent once it loads (their return values are discarded).

Attributes#

data-keystring
Your publishable key (pk_…) from Tracking. Safe to expose. Needed for intrio.track and the install check-in; without it the script still stores the partner and fills forms. You can pass ?key=pk_… on the script URL instead.
data-daysinteger
Cookie lifetime in days. Default 90. Set it to your programme's attribution window.
data-domainstring
Share the cookie across subdomains, for example example.com. See cross-subdomain attribution.

URL parameters read#

pp_refstring
Partner code, added by short links.
viastring
Partner code, for direct links. pp_ref wins if both are present.
pp_clickstring
Click id, added by short links.

The code must be 3 to 40 letters, numbers or dashes; it's stored in lower case. A new partner link overwrites the cookie, so the last partner link wins.

URL-encoded JSON, Path=/, SameSite=Lax, Secure on https, with Max-Age from data-days:

JSON
{ "ref": "maya-7k3q", "click": "Xb2k9QwLmN4pR7sT1vYz0a", "at": 1763640000000 }

Form fields#

When the page has loaded, the script fills any <input name="pp_ref"> and <input name="pp_click"> with the stored values, so a plain form posts them to your server:

HTML
<form method="post" action="/signup">
  <input type="email" name="email" required>
  <input type="hidden" name="pp_ref">
  <input type="hidden" name="pp_click">
  <button>Sign up</button>
</form>

Fields are filled at DOMContentLoaded, again whenever new inputs appear (forms rendered later by React or another framework), and on focus and submit. Add <input type="hidden" name="pp_at"> to also send the first-touch time for the attribution window.

JavaScript API#

intrio.ref()string | null
The stored partner code.
intrio.clickId()string | null
The stored click id.
intrio.attributedAt()string | null
When the visitor first followed the partner link (ISO 8601).
intrio.clientReferenceId()string | null
ref:click (or just ref). Pass it as Stripe Checkout's client_reference_id and Intrio credits the payment.
intrio.track(event, data)Promise<object>
Report a lead or sale. See below.

window.partnerRef is the same object, kept for older installs.

intrio.track#

JavaScript
// Lead: needs customer.email or customer.id
intrio.track("lead", { customer: { email: "sam@acme.com", name: "Sam Lee" } });

// Sale: needs id and amount (minor units)
intrio.track("sale", {
  id: "ORDER-1001",
  amount: 4900,
  currency: "GBP",
  customer: { email: "sam@acme.com" },
});

data

idstring
Your order or event id. Required for sale. Converted to a string.
amountinteger
Minor units. Required for sale.
currencystring
ISO code. Must match the workspace currency if given.
programmestring
Programme slug. Defaults to the workspace's oldest active Sign-ups or Sales programme.
customerobject
id, email and name. For leads, id or email identifies the customer.
  • If the visitor has no stored partner, track resolves to { status: "unattributed" } without a network request. Only partner-referred visitors are ever sent.
  • A lead is recorded as a signup with id web:lead:<id> (or the customer id or email when no id is given). A sale is recorded with id web:sale:<id>, as a payment on Sign-ups programmes and an order on Sales programmes. With Shopify connected, a Shopify order id (numeric or gid://shopify/Order/…) is recorded as shopify:order:<id>, the same id the Shopify app uses, so the order is credited once. The cookie's first-touch time is sent as attributed_at. Repeats of the same id are duplicates, so calling twice is safe.
  • Requests go to POST https://intrio.co/api/v1/track as text/plain, so there's no CORS preflight.

Responses#

On success, track resolves to the same result as the Conversions API: { status, message, referralId }. Otherwise it resolves (never rejects) with an error:

errorHTTPCause
missing_keyNo data-key on the script.
networkThe request failed.
invalid_json, invalid_request400, 422Malformed body or fields.
invalid_key401Unknown publishable key.
suspended403The workspace is suspended.
unknown_origin400No Origin header or page URL.
domain_not_allowed403The page's host isn't in your allowed domains (subdomains of a listed domain are allowed).
rate_limited429More than 60 requests a minute from one IP address.
no_programme422No programme given and no active link programme.
customer_required422A lead without customer.email or customer.id.
id_and_amount_required422A sale without id or amount.
paused503Browser tracking is temporarily paused platform-wide.

Install check#

Once per browser session the script sends a check-in so Tracking can show it's installed and on which host. The check-in doesn't need the domain to be allowed.

Shopify#

On Shopify storefronts the script also copies pp_ref and pp_click onto the cart as attributes, so they travel with the order. The Shopify integration installs the script for you.

Security#

The publishable key can only report leads and sales for partner-referred visitors from your allowed domains. Rewards on sales reported from the browser can be faked by a determined visitor, so set hold days on the programme, or report sales from your server or a platform integration instead.

Last updated 20 November 2026. Building with an AI assistant? Point it at /docs/llms-full.txt.