Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tracelit.io/llms.txt

Use this file to discover all available pages before exploring further.

Svelte
npm install @tracelit/tracker
Call init() inside onMount in your root layout so it only runs in the browser:
<!-- src/routes/+layout.svelte -->
<script>
  import { onMount } from 'svelte'
  import { init } from '@tracelit/tracker'

  onMount(() => init({ token: 'YOUR_TOKEN_HERE' }))
</script>

<slot />
onMount only runs on the client, so init() is never called during SSR. No extra guard needed.

Adding user identity

<!-- src/routes/+layout.svelte -->
<script>
  import { onMount } from 'svelte'
  import { init, identify, reset } from '@tracelit/tracker'
  export let data  // from +layout.server.ts

  onMount(() => {
    init({ token: 'YOUR_TOKEN_HERE' })
    if (data.user) {
      identify(data.user.id, { email: data.user.email, plan: data.user.plan })
    }
  })

  // React to auth changes
  $: if (data.user) identify(data.user.id, { email: data.user.email })
  $: if (!data.user) reset()
</script>

<slot />

Install with AI (Bolt, Lovable, Replit)

Bolt logo

Lovable logo

Replit logo
Install Tracelit in my SvelteKit project.
Initialize @tracelit/tracker in src/routes/+layout.svelte inside onMount:
init({ token: 'YOUR_TOKEN_HERE' })
Make minimal edits, show changed files, and include a 30-second verification checklist.

What’s next?

Identify users

Full guide to linking sessions to real users.

Feature tagging

Tag flows in session replays.