Install Foresite on SvelteKit
Paste your Foresite line into src/app.html, inside <head>:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script defer src="https://t.foresite.dev/s/YOUR_SITE_ID.js"></script>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
Every page uses app.html, so this covers the whole site. Foresite counts each client-side page change as a pageview automatically.
Visits to localhost aren't counted, so test on your deployed site: the Installation Check in Settings → Install turns green with the first pageview. If your site sends a Content-Security-Policy, allow t.foresite.dev (or your custom domain) in script-src and connect-src.