Appearance
SvelteKit
Install
sh
npx simpledatalogs init
npm install simpledatalogsOr by hand
sh
# .env
PUBLIC_SIMPLEDATALOGS_KEY=sdl_pub_…js
// src/hooks.client.js
import { init } from 'simpledatalogs'
import { PUBLIC_SIMPLEDATALOGS_KEY } from '$env/static/public'
init({ key: PUBLIC_SIMPLEDATALOGS_KEY, autocapture: true })hooks.client runs once in the browser, so the client is created once.
Only your own events
js
// src/lib/analytics.js
import { init } from 'simpledatalogs'
import { PUBLIC_SIMPLEDATALOGS_KEY } from '$env/static/public'
export const sdl = init({ key: PUBLIC_SIMPLEDATALOGS_KEY })Import sdl only from browser code (components, +page.svelte), not from server load functions.
In the first minute
session_startand apage_viewwithpath,title,referrerandutm_*.- A
page_viewon every client-side navigation. - Uncaught errors and unhandled rejections on the Logs tab.
Autocapture defaults
| Feature | autocapture: true |
|---|---|
| Page views, including client navigation | on |
| Sessions | on |
| Errors and unhandled rejections | on |
| Outbound link clicks | off |
| Do Not Track / Global Privacy Control | respected |