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.
<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 forintrio.trackand 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_refwins 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.
The pp_attr cookie#
URL-encoded JSON, Path=/, SameSite=Lax, Secure on https, with Max-Age from data-days:
{ "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:
<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 | nullref:click(or justref). Pass it as Stripe Checkout'sclient_reference_idand 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#
// 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.
customerobjectid,emailandname. For leads,idoremailidentifies the customer.
- If the visitor has no stored partner,
trackresolves to{ status: "unattributed" }without a network request. Only partner-referred visitors are ever sent. - A
leadis recorded as asignupwith idweb:lead:<id>(or the customer id or email when noidis given). Asaleis recorded with idweb:sale:<id>, as apaymenton Sign-ups programmes and anorderon Sales programmes. With Shopify connected, a Shopify order id (numeric orgid://shopify/Order/…) is recorded asshopify:order:<id>, the same id the Shopify app uses, so the order is credited once. The cookie's first-touch time is sent asattributed_at. Repeats of the same id are duplicates, so calling twice is safe. - Requests go to
POST https://intrio.co/api/v1/trackastext/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:
| error | HTTP | Cause |
|---|---|---|
missing_key | No data-key on the script. | |
network | The request failed. | |
invalid_json, invalid_request | 400, 422 | Malformed body or fields. |
invalid_key | 401 | Unknown publishable key. |
suspended | 403 | The workspace is suspended. |
unknown_origin | 400 | No Origin header or page URL. |
domain_not_allowed | 403 | The page's host isn't in your allowed domains (subdomains of a listed domain are allowed). |
rate_limited | 429 | More than 60 requests a minute from one IP address. |
no_programme | 422 | No programme given and no active link programme. |
customer_required | 422 | A lead without customer.email or customer.id. |
id_and_amount_required | 422 | A sale without id or amount. |
paused | 503 | Browser 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.