Skip to main content

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 and pick your website type on the Web tab — the page generates the right snippet for your vertical.

Most websites (Ecommerce, SaaS / B2B, Education, Real Estate, Other) use the standard 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.

Healthcare / hospital / clinic sites

Healthcare sites get a one‑tag, privacy‑safe auto‑tracking template instead:

<script
src="https://cdn.journeylayer.com/healthcare-autotrack.js"
data-jl-project="<PROJECT_PUBLIC_ID>"
async></script>

That single tag loads the SDK and detects common hospital‑site interactions automatically — page views (doctor profile / specialty / package page types), appointment booking starts + submits, click‑to‑call, WhatsApp clicks, enquiry submits, downloads and outbound links. Its privacy rules are enforced, not optional:

  • It never reads form field values — patient names, phone numbers, symptoms etc. are never collected; form events carry only the form's intent.
  • It never auto‑identifies visitors — they stay anonymous unless your code explicitly identifies them (use an opaque stable id, never email/phone/MRN).
  • Payment / checkout controls are never tracked.
  • Everything it captures is PII‑scrubbed, and the data-jl-prop-* escape hatch only accepts an allow‑list of non‑clinical keys.
Keep PII out of URLs and attributes

The SDK attaches the page URL to every event. Never put names, phone numbers, MRN/UHID/ABHA, symptoms or diagnoses in page URLs, query strings or data-jl-* attributes.

Other vertical templates

Auto‑tracking templates for Ecommerce, SaaS, Education and Real Estate are coming soon. Until then those verticals use the standard snippet plus JourneyLayer.track() for custom events.

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

  1. Open your site, then DevTools → Console. Type JourneyLayer and press Enter — you should see an object, not ReferenceError.
  2. DevTools → Network: reload and confirm a POST …/v1/events returns 202.
  3. In JourneyLayer → Profiles / Find People, your visit appears within ~5–10 seconds.
Page views are automatic

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