Skip to main content
tolt.js records a click when someone lands with a partner link, remembers it in a cookie, and binds the signup to that partner.
acme.com/?ref=samclick tolt.jssignup(email) Tolt
Saved as cookies
tolt_data30 days
click_id
partner_id
program_id
customer_idnull
Returned by signup()
result
customer_id
partner_id
click_id
program_id

Install

Add it to every page, as early in <head> as you can. Your public key is in Dashboard → Settings → Integrations; it is safe to ship to the browser. For framework setups, see Install the script.
In a single-page app, load the script before your router runs. If the router rewrites the URL first, ?ref=sam is gone before tolt.js can read it.

Script attributes

With data-stripe-type, tolt.js adds the click id to Stripe elements on the page, and keeps it there as the DOM changes:
  • payment_links: appends client_reference_id=<click_id> to links pointing at Stripe.
  • pricing_table: sets client-reference-id on <stripe-pricing-table>.
  • buy_button: sets client-reference-id on <stripe-buy-button>.

The window.tolt API

Bind the signup

Call signup() after your own signup succeeds. It waits for the click to be recorded, and ?. skips it if an ad blocker stopped the script. If your signup completes as the page loads, for example on an OAuth callback, check window.tolt first and wait for the toltScriptLoaded event if it isn’t there yet.
Pass a stable identifier: the user’s email or your own user id. To record payments, use the Tolt id it returns (result.customer_id, cus_...), not that identifier.
signup() never throws. On a network error or after its 8 second timeout it resolves undefined; a duplicate call in flight resolves { message }. Check result?.customer_id instead of wrapping it in try.
A successful result carries the new customer (plus a message):

ToltData

getTracking() returns null when the visit did not come from a partner link. Otherwise every field can still be null until it is known.
string | null
The recorded click. Send it to POST /v2/customers, together with partner_id, if you bind customers from your server.
string | null
The partner whose link was followed.
string | null
The program the link belongs to.
Days the referral is remembered (your program’s cookie window).
string | null
Set after a successful signup(), so you can skip binding twice.

Tracked URL params

tolt.js reads the first of these it finds in the query string (or the hash): tolt ref aff via lmref fpr tap_s afmc f2f-ref join ali The value must match a partner link in your program, e.g. acme.com/?ref=sam or acme.com/pricing?via=sam.

Cookies

Both last for the program’s cookie window (30 days if unset), on the domain described above. On HTTPS they are set Secure; SameSite=None.

Legacy globals

Older integrations can keep reading window.tolt_referral (click id) and window.tolt_data (ToltData). The script also fires a toltScriptLoaded event on window and document when it is ready; prefer await tolt.ready() in new code.