Skip to content

Install on SvelteKit

The tag belongs in src/app.html, the template SvelteKit wraps around every page it renders.

SvelteKit renders every page into one HTML template. Put the tag in that template and it ships with every route, prerendered or server-rendered.

Where it goes

Open src/app.html and paste the tag inside <head>, next to %sveltekit.head%.

src/app.html
<head>
  <meta charset="utf-8" />
  <script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://statsy.co/js/script.js"></script>
  %sveltekit.head%
</head>

A <svelte:head> block in +layout.svelte also works, but app.html is simpler and cannot be forgotten by a nested layout that opts out.

Confirm it works

Deploy, open the site, and watch Live. Then click an internal link: SvelteKit’s client-side router uses history.pushState, which the script tracks, so the path changes without a reload.

Prerendered pages are fine

Fully prerendered routes carry the tag in their static HTML, so they report like any other page. What will not report is a route served by a different host, such as a preview deployment on the platform’s own domain: add that host under Site settings › General › Additional domains first, or leave it out so staging never mixes with production.

Last updated · Markdown version