Thunder Script is a lightweight, asynchronous snippet (typically added in your site’s <head>) that collects visitor, source, and login attribution data in real time. By embedding a small JavaScript file, Thunder can:
Identify visitors across sessions (durable device/user identifier)
Capture landing (first-visit) context: referrer, UTM parameters, and click IDs
Detect and attribute logins (when you provide customer info in localStorage)
Persist key attribution parameters while gracefully handling browser storage limitations
Thunder-generated IDs: uid (persistent) and jid (journey/session)
Login context (login event)
Same context as above, plus your provided customer attributes:
id
email (lowercased)
phone (normalized to E.164-like format, e.g., +15551234567)
Note: Thunder does not collect payment details or other sensitive fields by default. Only the data you provide (e.g., user object) and the visitor/session attribution context are sent.
Thunder inspects the current URL and the document referrer:
If a ref param is missing and the referrer domain is different from the current domain, Thunder appends ref=<referrer-domain>.
If UTM or click ID params are missing on the current page but present on the referrer, Thunder appends normalized “thdr_” parameters to preserve attribution:
UTM params mirrored as: thdr_utm_source, thdr_utm_medium, thdr_utm_campaign, thdr_utm_term, thdr_utm_content, plus custom tg/tm/tk/ts groups (tg1–tg4, tm1–tm4, tk1–tk4, ts1–ts4), ti, tc.
Click ID mappings:
gclid, dclid, wbraid, gbraid → thdr_tg0
fbclid → thdr_tm0
ttclid → thdr_tk0
sccid → thdr_ts0
When parameters are added, Thunder uses history.replaceState (or falls back to redirect) to update the URL without additional page loads.
uid (durable ID): generated via crypto.randomUUID() when available (fallback to RFC4122 v4-like). Stored persistently (localStorage) and mirrored in session storage (and cookies as a last resort).
jid (journey/session): generated for the visit and stored non-persistently to mark session boundaries.
Consent: Depending on your region (e.g., GDPR, CCPA), configure consent banners and ensure Thunder Script only runs and/or stores identifiers after consent where required.
Data you provide: If you store email and mobile in localStorage.user, Thunder will transmit those values as provided. Consider hashing or tokenizing customer identifiers on your side if required by your policies.
Cookies and storage: Thunder uses SameSite=Lax for cookies and prefers web storage when available.
No sensitive payment data: Thunder does not collect payment details by default.
Always consult your legal team to ensure your implementation complies with applicable regulations.