To add Obsidesk to SvelteKit, paste the script tag into src/app.html. You get visitors, routes, signups and, with a connected revenue source, revenue by channel. Client-side navigation is recorded as page views.
What you get
- Visitors and routes including client-side navigation
- Signups from forms with an email field
- Custom events
- Revenue by channel and landing page
- Cookieless tracking
Set it up
- 1Create your account and add your domain
Sign up, add the domain you want to track and copy your site ID from Settings. Every plan has a 14-day money-back guarantee; there is no free trial.
- 2Add the script to src/app.html
Put it in
<head>, above%sveltekit.head%.<script defer src="https://obsidesk.com/script.js" data-site="YOUR_SITE_ID"></script>
- 3Deploy and check
Open your site in a normal browser window and check that the visit appears in the live view. Visits on localhost are not counted unless you add
data-allow-localhost, and your own visits can be excluded by opening#obsidesk-ignoreonce. - 4Track an event from a component
Call it from any handler in the browser.
<button on:click={() => window.obsidesk?.track("Upgrade clicked", { plan: "pro" })}>Upgrade</button> - 5Optional: npm package
Also available as
@obsidesk/analyticswithinject()in+layout.svelte, guarded withif (!dev). The script tag needs none of that.
Why app.html
Putting the script in src/app.html loads it on every page without touching your layouts, and it is outside Svelte's reactivity, so nothing needs cleanup.
Revenue
Connect Stripe or another source under Settings, then Revenue. If you create Checkout sessions in a +server.ts route, pass the browser's window.obsidesk?.id as client_reference_id.
FAQ
How do I add analytics to SvelteKit?
Paste the Obsidesk script tag into src/app.html inside <head>.
Does it track SvelteKit client-side navigation?
Yes, history changes are recorded as page views.
Is there an analytics tool for SvelteKit SaaS that shows revenue?
Obsidesk connects traffic to Stripe, Paddle, Polar and Whop revenue. See features.
Works with
Connect SvelteKit in about a minute.
14-day money-back guarantee. Installed in 30 seconds. Read-only revenue connections.