Skip to main content
Fully automated for both SvelteKit and plain Svelte.

Install with the CLI

Pick Svelte / SvelteKit when prompted, then choose your setup.

SvelteKit

1

Environment variable

.env:
2

Init module

src/lib/lucent.ts:
3

Call initLucent in the root layout

src/routes/+layout.svelte:

Plain Svelte

1

Environment variable

.env:
2

Init module

src/lib/lucent.ts:
3

Call initLucent in your root component

src/App.svelte:

Notes

  • SvelteKit uses $env/static/public for publicly‑accessible env vars that need the PUBLIC_ prefix. Plain Svelte uses the Vite VITE_ prefix.
  • onMount ensures the tracker only initializes in the browser — the init module is safe to import during SSR, but calling initLucent() at the module top level would crash on the server.