Skip to main content
The TrackRev pixel (p.js) is a dependency-free script — under 3 KB — that connects a browser session to the visitor TrackRev is following. It records pageviews, lets you attach an email to a visitor with identify(), and hands the visitor’s identity through to your checkout so a purchase can be joined back to the click that produced it.
You only need the pixel for revenue attribution and pageview analytics. Click tracking on your short links works without it — clicks are recorded server-side at the redirect. Install the pixel on the destination site (your marketing site and your app), not on the link.

Get your snippet

1

Open the Integrations tab

In your workspace, go to Settings → Integrations (the top-level Integrations link redirects here). Your install snippet is shown under “1 · Install the pixel”, pre-filled with your workspace ID.
2

Copy the script tag

It looks like this — data-id is your workspace UUID:
3

Paste it into your site head

Add it to every page you want to track. On most sites that means the shared layout, template, or <head> partial so it loads everywhere at once.
4

Verify it's live

Back on the Integrations tab, click Verify pixel. TrackRev loads your site and confirms the script is firing. See Verify your install below.

Where to add it, by stack

What the pixel does automatically

Once loaded, the pixel:
  • Resolves a visitor id (vid). If the visitor arrived through a TrackRev link, the redirect handed off the id in the URL (?_vid=…) and that always wins, so the server-side click and this browser session share one identity. Otherwise it reads (or creates) a first-party vid cookie.
  • Writes the vid cookie on your registrable domain (e.g. .example.com), so one identity spans your marketing site, app and checkout subdomains. The cookie is first-party and lasts one year.
  • Sends the first pageview, then exposes window.trk for everything else.
Because the cookie is set from your domain, not a third-party tracker, it is not blocked by Safari ITP the way third-party cookies are, and it is invisible to most ad-blockers. This is what “first-party tracking” means in TrackRev.

The window.trk API

After the script loads, these methods are available on window.trk:
window.trk.vid
string
The current visitor id. Pass this to your checkout so a purchase can be joined back to the click — see Connect your revenue.
window.trk.identify(email, props?)
function
Attach an email (and optional properties) to the current visitor. Call it the moment you learn who someone is — on sign-up, login, or newsletter subscribe. Email is TrackRev’s fallback for joining a payment to a visitor when no checkout reference is present.
window.trk.track(event, props?)
function
Record a custom event (e.g. "signup", "trial_started") with arbitrary properties.
window.trk.pageview()
function
Manually record a pageview. Useful in single-page apps where route changes don’t reload the document — call it on every client-side navigation.

Identify a visitor

Call identify() as soon as you know the visitor’s email:

Track a custom event

Record pageviews in a single-page app

The pixel fires one pageview on load. In an SPA, fire one on each route change:

Options

Set these as attributes on the script tag.
data-id
string
required
Your workspace UUID. Found on the Integrations tab. The pixel does nothing without it.
Force the cookie’s Domain explicitly, e.g. .example.com. By default the pixel detects your registrable domain automatically; set this only if auto-detection picks the wrong scope (rare — mostly needed on unusual multi-domain setups).

Verify your install

1

Run the built-in check

On the Integrations tab, click Verify pixel. TrackRev fetches a page from your site and confirms the script is present and firing. A green tick means you’re done.
2

Or check it yourself in the console

Open your site, open the browser dev tools console, and type:
You should see an object with identify, track, pageview and a vid string. If it’s undefined, the script hasn’t loaded — check that the tag is in the <head> and that no content blocker is stripping it.
3

Confirm the cookie

In dev tools → Application → Cookies, look for a vid cookie on your domain. Its presence confirms the pixel is identifying the visitor.
If window.trk is defined but revenue never attributes, the usual cause is that the vid isn’t reaching your checkout. Make sure you pass window.trk.vid as the checkout reference — see Pass the visitor id to checkout.

Next steps

Connect your revenue

Link your payment processor so clicks become attributed revenue.

Pass the visitor id to checkout

The one line that joins a purchase back to the click that earned it.