Skip to content
Documentation
Installation

Install Talvess with Astro

Include the tracking script in the shared layout for your Astro pages.

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 to the head of the shared layout used by the pages you want to track.

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

src/layouts/Layout.astro
<html lang="en">
  <head>
    <script
      is:inline
      defer
      src="https://YOUR_TALVESS_DOMAIN/script.js"
      data-website-id="YOUR_WEBSITE_ID"
    ></script>
  </head>
  <body>
    <slot />
  </body>
</html>

The is:inline directive leaves this external script in the generated HTML instead of bundling it. Keep your existing layout content and slot.

See the Astro external script 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.