Antlytics logoAntlytics

SvelteKit

Install

npm install @antlytics/svelte

Usage

Add the <Analytics> component to your root layout (src/routes/+layout.svelte):

<!-- src/routes/+layout.svelte -->
<script>
  import { Analytics } from '@antlytics/svelte'
</script>

<Analytics trackingId="YOUR_TRACKING_ID" />
<slot />

The component sends a pageview when the layout first mounts and on every client-side navigation via SvelteKit's afterNavigate lifecycle hook. No additional configuration required.

Props

PropRequiredDefaultDescription
trackingIdYesUUID from Antlytics → Sites
apiHostNohttps://www.antlytics.comUse your own first-party proxy

Verify data is flowing

Start your dev server (vite dev) and open the app in a browser. Check the real-time count in your Antlytics dashboard — data appears within seconds.

See Troubleshooting for common issues.

Something missing? Get in touch and we will update these docs.