Skip to content
Documentation
Installation

Install Talvess with SvelteKit

Add the tracker to SvelteKit's shared app.html template.

Register your website

Sign in and add your website. Register its exact origin, including the protocol, hostname, and any port. Copy the script URL and website ID from your generated setup snippet.

Add the script

Add the script inside the head of src/app.html, the template shared by your SvelteKit pages.

Replace YOUR_TALVESS_DOMAIN and YOUR_WEBSITE_ID with the values from setup. Add the highlighted lines to your existing file.

src/app.html
<html lang="en">
  <head>
    %sveltekit.head%
    <script
      defer
      src="https://YOUR_TALVESS_DOMAIN/script.js"
      data-website-id="YOUR_WEBSITE_ID"
    ></script>
  </head>
  <body data-sveltekit-preload-data="hover">
    <div style="display: contents">%sveltekit.body%</div>
  </body>
</html>

Keep the SvelteKit head and body placeholders, along with your existing metadata. The body placeholder should stay inside its wrapper element.

See the SvelteKit app template documentation for the framework's configuration details.

Verify installation

  1. Publish your changes and open your website in a browser.
  2. In Talvess, open your website menu, choose Check installation, then Run checks.
  3. Open Analytics and select a date range that includes your visit.

The tracker records the first pageview and follows pathname changes in single-page applications. Do not add a separate pageview call for route changes. Query-string and hash-only changes do not count as pageviews.

If your site uses Content Security Policy, allow your Talvess origin in script-src and connect-src. If visits do not arrive, follow the troubleshooting guide. Read what is collected for browser storage and privacy details.