Guides
Getting started
Install tracking, verify events, connect destinations, and understand the data flow end-to-end.
Trackrift ingests browser and server events through a collector (POST /collect), resolves identity server-side, and forwards conversions to ad platforms via CAPI. The fastest path is the Universal Script — no npm, no build step.
Prerequisites
| Requirement | Where to find it |
|---|---|
| Workspace account | https://app.trackrift.com — sign up or sign in |
| public_id (12 chars) | Settings → Tracking → Universal script snippet |
| Marketing domain | Site where the script will load (HTTPS recommended) |
| Optional: CNAME subdomain | Settings → Tracking → Custom domain (e.g. t.yourbrand.com) |
Install the Universal Script
- Copy the snippet from Settings → Tracking (or use the placeholder below — replace
YOUR_PUBLIC_IDbefore production). - Paste in
<head>as early as possible, or deploy via GTM / Webflow / Framer custom code. - Publish your site. The script loads
/v1/u.js?id=PUBLIC_ID, which injectsaccountIdand enables autocapture. - Open Settings → Tracking → Live verification — you should see
page_viewwithin ~5 seconds. - Optional: add your domain to Allowed origins if you restrict ingest by hostname.
- Optional: configure a custom CNAME for first-party delivery (see CNAME guide).
- Connect Meta / Google / TikTok under Settings → Destinations for server-side forwarding.
<script async src="https://api.trackrift.com/v1/u.js?id=YOUR_PUBLIC_ID"></script>What happens on first page load
Sequence: (1) browser requests /v1/u.js → (2) SDK calls GET /bootstrap to set _aid / _ses cookies → (3) page_view queued → (4) batch flushed to POST /collect via sendBeacon or fetch with keepalive. UTMs and click IDs from the URL are attached to the event context; UTMs are not persisted client-side (by design — see attribution docs).
After install — fire high-value events explicitly
// Universal script exposes window.trackrift, or use npm @trackrift/sdk
window.trackrift?.track('lead', {
properties: { form: 'hero', plan: 'starter' },
});
const eventId = window.trackrift?.track('purchase', {
value: 297,
currency: 'USD',
content_ids: ['sku_starter'],
});
// Pass eventId to Meta Pixel for dedupe — see CAPI docsTag managers
In GTM use a Custom HTML tag, firing on All Pages, priority above marketing pixels if you need click IDs on the first paint. Do not defer the script until DOMContentLoaded unless you accept losing early-page UTMs.
Staging vs production
Use separate Trackrift workspaces for staging and production. Never reuse the same public_id across environments — events will merge into one workspace and corrupt attribution.
Environment checklist
| Check | Pass criteria |
|---|---|
| Script loads | Network tab: u.js 200, no ad-blocker intercept |
| Bootstrap | GET /bootstrap 200; _aid cookie set on collector domain or CNAME |
| Collect | POST /collect 204 within 2s of page load |
| Dashboard | Live verification shows page_view with correct page.url |
| Identify | After login, identify() or email in event links journey |