> ## Documentation Index
> Fetch the complete documentation index at: https://tinyanalytics.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SvelteKit Analytics Integration

> Add tinyanalytics to src/app.html so the script loads across SvelteKit and records each client-side navigation automatically.

To add tinyanalytics to a **SvelteKit** app, paste the tracking snippet into `src/app.html`, the shell that wraps every page. It loads once for the whole app, and client-side navigation is tracked automatically.

## Before you start

* A tinyanalytics site. If you don't have one yet, follow the [Quickstart](/docs/tinyanalytics-quickstart).
* Your snippet from **Settings → Tracking** in your dashboard.

## Add the snippet to `src/app.html`

Add the tag to the `<head>`, next to the `%sveltekit.head%` placeholder:

```html src/app.html theme={null}
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    %sveltekit.head%
    <script defer src="https://dash.tinyanalytics.io/script.js"
      data-site-id="YOUR_SITE_ID"></script>
  </head>
  <body data-sveltekit-preload-data="hover">
    <div style="display: contents">%sveltekit.body%</div>
  </body>
</html>
```

<Tip>
  Replace `YOUR_SITE_ID` with your real site ID, and copy the full snippet from **Settings → Tracking** if you've toggled any options.
</Tip>

## Client-side navigation is tracked automatically

SvelteKit renders route changes on the client, and tinyanalytics records each one as a new pageview by default (`data-track-spa`). Moving between pages is captured for you. See [Track single-page apps](/docs/configure-tinyanalytics-tracking-script#track-single-page-apps) to change this.

## Verify

Run or deploy your app, open it in a browser, then check **Realtime** in your dashboard for your visit. See [Verify your setup](/docs/verify-tinyanalytics-installation) for the full check.

<Check>
  Your install is working when your own visit appears in **Realtime** in your dashboard.
</Check>

## Related

<Columns cols={2}>
  <Card title="Install on any platform" icon="puzzle-piece" href="/docs/integrations/install-website-analytics">
    The universal method and other platforms.
  </Card>

  <Card title="Configure the tracking script" icon="sliders" href="/docs/configure-tinyanalytics-tracking-script">
    Every `data-*` option you can set.
  </Card>

  <Card title="Track custom events" icon="hand-pointer" href="/docs/custom-event-tracking">
    Send events from your components.
  </Card>

  <Card title="Verify your setup" icon="circle-check" href="/docs/verify-tinyanalytics-installation">
    Confirm tracking works.
  </Card>
</Columns>


## Related topics

- [Install the tinyanalytics Tracking Script](/docs/install-tinyanalytics-tracking-script.md)
- [Configure the tinyanalytics Tracking Script](/docs/configure-tinyanalytics-tracking-script.md)
- [Angular Analytics Integration](/docs/integrations/angular-analytics.md)
