Showing

How do I install the LinkJolt tracking script?

Copy the one line script tag from the Integration Hub in your dashboard and paste it into the head of every page a visitor can land on. Copy it rather than typing it, because the tag carries your own merchant ID and a wrong ID never raises an error.

5 min read
Updated Oct 28, 2026

Copy the one line script tag from the Integration Hub in your dashboard and paste it into the <head> of every page a visitor can land on. It looks like this:

<script src="https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID" async></script>

Copy it from the Integration Hub instead of typing it out. The id is your own merchant ID and the page fills it in for you. If you run more than one brand, the snippet shown belongs to the brand you are currently switched to, so check the brand name at the top of the sidebar first.

Where the snippet goes

The script has to run on any page an affiliate link can point at, not only your checkout. When a visitor arrives with ?tc=...&aff=... in the URL, the script stores those values in a cookie and in localStorage for 30 days, so the sale is still attributed when they buy days later.

  1. Open Integrations, under the Set up heading in the dashboard sidebar. The page itself is titled Integration Hub.
  2. Pick your platform tab and find the step called "Add the tracking script".
  3. Copy the HTML snippet and paste it inside <head> on every page.
  4. Deploy, then load one of your own pages in a fresh browser session.

Put it in the head of every page, including your homepage, landing pages and blog. A visitor who lands on a page without the script has nothing stored, so a purchase later in that visit cannot be credited to the affiliate's link. Coupon code attribution is the exception, because it needs no script at all.

Next.js, Vite and Lovable apps

Under the tracking script line, open "Using Next.js, React, Vite or Lovable?" and pick what your site is built with. Each choice shows the same address and merchant ID, in the shape that app takes.

Next.js: the Script component, inside <body> of your root layout, app/layout.tsx. On the Pages Router, put it in pages/_app.tsx instead.

import Script from 'next/script'; // inside <body> of the root layout <Script src="https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID" strategy="afterInteractive" />

React with Vite, Lovable projects made before 13 May 2026 included: a plain script tag works. Paste the same line as above into the <head> of your index.html.

Lovable or TanStack Start: Lovable projects made since 13 May 2026 run on TanStack Start and have no index.html. Add the script to head() in src/routes/__root.tsx, next to your meta tags:

// src/routes/__root.tsx, in the root route's options head: () => ({ meta: [ // your meta tags, as they are ], scripts: [ { src: 'https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID', async: true }, ], }),

If your Lovable project has an index.html, it is the older kind: use the plain tag. To have Lovable make the change for you, click Copy for AI in the Integration Hub and paste it into Lovable's chat.

Each version covers every page, because it sits in the part of the app every page shares.

Check that it worked

Load one of your pages, open the browser console and run window.linkjolt.getTrackingInfo(). If window.linkjolt is undefined, the tag is not on that page. To test end to end, follow one of your affiliate tracking links through to your site, then check window.linkjolt.referral, which returns a string shaped like tc_..._aff_..._cid_....

The Integration Hub also shows a status line, read when the page loads, so reload it after you test:

  • Affiliate clicks recorded: the script reported in within the last 24 hours and your campaigns have clicks from the last 30 days.
  • Tracking script detected: the script reported in within the last seven days, but not in the last 24 hours, or with no affiliate clicks in the last 30 days.
  • Tracking script not detected: nothing has reported in for seven days or more.

Each browser reports in at most once an hour, so test in a fresh session, and expect the status to go quiet again if nobody visits for a week.

A wrong merchant ID never raises an error

Nothing warns you. The script still loads and still stores tracking parameters, so link clicks and sales keep being attributed, but the check-in that carries your ID is discarded and the status stays on Tracking script not detected. It happens when you paste a snippet from another account, from a different brand, or from an old note. If you moved to LinkJolt from another affiliate platform, a wrong ID also stops us recognising your affiliates' old links. Re-copy the snippet from the Integration Hub and compare it with what is live on your site.

Editing the ID in your own tag changes the URL, so a correction takes effect on the next page load. The script file itself is cached for a day, so when we release a new version your returning visitors pick it up over the following day or two.

The script is one half of tracking. Your payment processor webhook is the other half, and it is what actually records the sale, so follow "How do I set up affiliate tracking with Stripe?" next. If the script is installed but clicks are not appearing, see "I installed the tracking script but clicks are not being tracked. What now?".

Watch how it is done

Is My Affiliate Tracking Working? How to Check in a Minute (1:40)

Plumquote is a demo account made for this tutorial.

Watch on YouTube
Read the transcript

Copy the test link 0:00

You've added the LinkJolt tracking script to your site. Here's how to check it works in about a minute, before a real affiliate sends you a customer.

In LinkJolt, open Integrations, and on your payment tab, scroll down to Check it works. It's worth doing once, right after setup.

The first step gives you a test link: your own site, with a test affiliate added to the address. Copy it.

Check the console 0:23

Open it in your browser. The page looks the same, but the script is reading the test affiliate from the address.

To see it, open your browser's console on that page. First, check that the script loaded.

True. Next, ask for the referral: the string your checkout passes to Stripe.

It reads tc_test123_aff_test456. That's the test affiliate. A real affiliate link gives the same shape, with their own codes.

See it detected, and the usual causes 0:55

Back in LinkJolt, reload the page. The tracking script now shows as detected, on your site.

If something's off, open Still not showing up. window.linkjolt is undefined means the script isn't on the page: check that it sits in your head.

Referral is null means the visitor didn't arrive through an affiliate link. Try the test link again.

And a purchase made in Stripe test mode is recorded as a test sale, under Test sales on Commissions, apart from your live ones.

Next step 1:26

Then make one real purchase through an affiliate's link, and you'll see it on Commissions. Try LinkJolt free for seven days at linkjolt.io.

Start your affiliate program

Launch in minutes with 0% platform fees. 7-day free trial, cancel anytime.