Skip to main content

Via app.html

The simplest approach: add the script to src/app.html before </body>:
src/app.html

Via +layout.svelte

To load the tracker from your Svelte component tree, add it in src/routes/+layout.svelte:
src/routes/+layout.svelte
OpenRevenue’s tracker listens to history.pushState automatically, so SvelteKit client-side navigation is tracked without extra setup.

Verify

Deploy and visit your site. Check your OpenRevenue dashboard: a pageview should appear within seconds.
OpenRevenue ignores localhost automatically. Always test on your deployed URL.