JavaScript tracker
Start tracking partner sales with a copy-and-paste snippet and no backend changes.
- First-party cookie
- One snippet for all pages
- Works with single-page apps
- Pairs with postbacks
21 days with every live feature. No card needed.
The order page calls the tracker
Order confirmation page
trackspot('conversion', {
amount: 49.00,
currency: 'USD',
orderId: 'A-1001'
})- Click ID from cookie
clk_7Q2M- Cookie
- First-party, on your domain
- Result
- Conversion for partner
#104
Teams that work with us
JavaScript tracker in detail
Add one script to your site to save the click ID in a first-party cookie and record conversions from the browser.
What the script does
The tracker reads the click ID from the landing page URL and saves it in a first-party cookie on your own domain. When the visitor converts, a call to the tracker sends the saved click ID and the order details to trackspot.ai. A basic setup needs no backend work and no developer time beyond pasting the snippet.
Record a conversion
On your order confirmation page, call the tracker with the amount, currency and order ID. For example: trackspot('conversion', { amount: 49.00, currency: 'USD', orderId: 'A-1001' }). The tracker adds the click ID from the cookie and sends the request. The order ID stops a page reload from creating a second conversion.
When to use a server postback
Browser tracking works only if the page loads and the cookie is still there. Payments that finish on a hosted checkout, in a mobile app or in a backend job are better tracked with a server-to-server postback. Many merchants use both: the script saves the click ID and the server sends the conversion.
Set it up in 5 steps
Each step names the screen in your dashboard. Guides with screenshots are in the help center.
Go to Settings → Tracking → JavaScript tracker and copy the snippet.
Paste the snippet into the head of every page on your site.
Add the conversion call to your order confirmation page.
Click a test tracking link and finish a test order.
Check Reports → Conversions for the test order.
What partner teams tell us
We will publish named customer stories here once customers approve them. Until then, this is a sample quote.
“We moved our postbacks to server-side and stopped arguing with partners about missing sales.”
Questions about JavaScript tracker
Does the tracker work across subdomains?
Yes. Set the cookie domain to your root domain, for example .yourbrand.com, and the click ID is readable on www, shop and app subdomains.
Does the script slow down my pages?
The script loads asynchronously, so it does not block your page from rendering.
Works well with
Server-to-server postbacks
Report conversions from your server to trackspot.ai with a postback URL, so browser limits and ad blockers cannot stop them.
Attribution windows
Set how long after a click a conversion still counts, and which partner gets credit when more than one sent the buyer.
Direct linking
Track partner traffic that goes straight to your site, with no redirect through a tracking domain.
Coupon tracking
Assign coupon codes to partners and credit them for every order that uses the code, with or without a click.
Try JavaScript tracker on your own program
It is in the 21-day trial with every other live feature. Send your first server-to-server postback and see real conversions on day one.