Install the Website SDK
The JourneyLayer Website SDK is a single <script> tag. It auto‑tracks page
views and exposes JourneyLayer.track() / identify() / reset() for your own
events. No build step, no npm install.
1. Copy your snippet
Open Settings → SDK / Install in the dashboard. The Web tab shows a snippet pre‑baked with your Project Public ID and publishable browser token:
<script src="https://cdn.journeylayer.com/p/<PROJECT_PUBLIC_ID>/jl-script.js" async></script>
If you've set up a first‑party tracker domain, the
snippet uses that host instead (e.g. https://track.yourdomain.com/p/…), which
improves deliverability past ad‑blockers.
2. Add it to your site
Paste the snippet inside <head> (or just before </body>) on every page.
On most sites you add it once to a shared header/footer template. That's it —
the bundle initializes itself on load and creates a global JourneyLayer.
3. Verify it works
- Open your site, then DevTools → Console. Type
JourneyLayerand press Enter — you should see an object, notReferenceError. - DevTools → Network: reload and confirm a
POST …/v1/eventsreturns 202. - In JourneyLayer → Profiles / Find People, your visit appears within ~5–10 seconds.
You don't need to call anything for page views — the SDK fires a pageview
event on load and on SPA route changes. See Auto pageview & the tracking
API.
What loads
The hosted bundle is small and cached for ~5 minutes (with stale‑while‑revalidate), so rotating your publishable token takes effect for visitors within a few minutes. It captures device + UTM context automatically and batches events in the background.
Next
- First‑party tracker domain — serve the SDK from your own subdomain.
- Allowed website domains — control which origins may send events.
- Tracking API —
track,identify,reset. - Event examples — copy‑paste recipes.