Skip to content
trackrift

Documentation

SDK

Attribution & click IDs

UTM strategy, click ID persistence, cross-domain _aid, short links, magic links.

AI brief: UTMs: URL-only per event (not persisted) so attribution models work. Click IDs (fbclid, gclid, etc.): persisted last-touch. Cross-domain: ?_aid and tracker.link(). Short URLs: ?_lid inbound_link_id in context.

Attribution data flows from the URL into each event context. The SDK deliberately avoids persisting UTMs in localStorage — doing so would poison multi-touch models. Click IDs for ad platforms are persisted with last-touch semantics.

UTM parameters

ParamPersisted?Creates touchpoint
utm_sourceNo — URL onlyYes, per landing with UTMs
utm_mediumNoYes
utm_campaignNoYes
utm_contentNoYes
utm_termNoYes

Click IDs (CAPI-critical)

ParamPlatformPersistence
fbclidMetaLast-touch in localStorage
gclidGoogle AdsLast-touch
ttclidTikTokLast-touch
msclkidMicrosoftLast-touch
li_fat_idLinkedInLast-touch
cross-domain.ts
// Site A — marketing landing
const url = tracker.link('https://app.example.com/signup');
// → https://app.example.com/signup?_aid=anon_xyz

// Site B — product app (same or different init)
tracker.init({ endpoint: 'https://api.trackrift.com', publicId: 'YOUR_PUBLIC_ID' });
// bootstrap reads ?_aid= and adopts anonymous_id

Email campaigns can include ?_uid=<signed_token>. On load the SDK POSTs to /m to merge the anonymous journey with a known identity without a login form.

Internal navigation without UTMs

page_view on /pricing after landing on /?utm_source=google will NOT include UTMs — that is correct. Server touchpoints were recorded on the landing event.