Docs menu

Get started

Install the tracking script

Add one script tag to your site's head, with notes for HTML, Next.js, WordPress, Shopify, Webflow and tag managers, then check it works.

On this page 9 sections

Add one script tag to the head of every page you want counted. Replays and heatmaps record only after consent; data-replays="off" or data-heatmaps="off" turns them off. See Replays and heatmaps and Cookies and consent.

The script

Copy the tag from the Add the tracking script sheet in Setup, or Settings, Connections, Tracking script.

<script defer src="https://your-lundot-address/script.js" data-website-id="your-website-id"></script>
  • data-website-id ties visits to your site. See Add a site.
  • data-privacy appears only for Strict (strict) and Consented (consented); Standard has none. Change the profile with Change on the Privacy profile row, or in Site settings, under Tracking. Lundot enforces the stored profile, but replace the tag on your site too.

All options are in Tracking script. The script sets no cookies and uses no browser storage.

Where to put it

Paste the tag inside the <head>, ideally in a site-wide layout.

Platform Where What to do
HTML The head of every page 1. Open the template or layout every page shares. 2. Paste the code inside the head, before the closing head tag. 3. Publish the change.
Next.js app/layout.tsx 1. Open the root layout, app/layout.tsx, or pages/_app.tsx with the pages router. 2. Import Script from next/script and render the element once: inside the body of the layout, or next to the page component in _app. 3. Deploy. Route changes are counted without extra code.
React index.html 1. Open index.html at the project root (public/index.html in older setups). 2. Paste the code inside the head. 3. Build and deploy. Route changes are counted without extra code.
Astro src/layouts/Layout.astro 1. Open the layout your pages share, such as src/layouts/Layout.astro. 2. Paste the code inside the head. is:inline keeps Astro from bundling it. 3. Build and deploy.
WordPress The site header 1. Install a plugin that adds code to the site header, or open your theme's header.php. 2. Paste the code in the header section, before the closing head tag. 3. Save. Clear any page cache so visitors get the new header.
Shopify layout/theme.liquid 1. In Shopify admin, open Online Store, then Themes, then Edit code. 2. Open layout/theme.liquid and paste the code before the closing head tag. 3. Save. Checkout pages need the Shopify web pixel as well, because Shopify does not run theme scripts there.
Webflow Site settings, Custom code 1. Open Site settings, then Custom code. 2. Paste the code into Head code and save. 3. Publish the site. Custom code needs a paid site plan.
Squarespace Code injection, Header 1. Open Code injection, under Website tools or Settings, then Advanced. 2. Paste the code into Header and save. Code injection needs a plan that includes it.
Wix Custom code, Head 1. Open Settings, then Custom code, then Add custom code. 2. Paste the code, choose All pages and place it in Head. 3. Apply. Custom code needs a premium plan and a connected domain.
Framer Site settings, Custom code 1. Open Site settings, then General, then Custom code. 2. Paste the code into the end of the head tag. 3. Publish the site.
Tag Manager A Custom HTML tag 1. In your container, create a tag of type Custom HTML and paste the code. 2. Set the trigger to All pages. 3. Submit and publish the container.

Next.js

import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://your-lundot-address/script.js"
          data-website-id="your-website-id"
        />
      </body>
    </html>
  );
}

Built with, then Next.js, in Setup fills in your values.

Tag managers

A tag manager can load the script. With consented, the script also reads Google Consent Mode updates from window.dataLayer. See Tracking script.

Frameworks

Put the tag in the shared head:

Framework File
Vue index.html at the root (Vite), or public/index.html (Vue CLI).
Nuxt app.head.script in nuxt.config.ts, with src, defer: true, data-website-id and data-privacy.
Svelte and SvelteKit src/app.html, in the head.
Remix app/root.tsx, a <script defer ... /> in the root component's <head>.
Angular src/index.html, in the head.

Content Security Policy

If your site sends a Content-Security-Policy, add your Lundot address to two directives:

script-src https://your-lundot-address;
connect-src https://your-lundot-address;
  • script-src loads script.js and, after replay consent, recorder.js.
  • connect-src lets the script send to /api/send and /api/record.
  • A policy with a nonce. Give the tag the page's nonce, for example <script defer nonce="..." src="..." data-website-id="..."></script>. With 'strict-dynamic', browsers trust only nonced scripts. In Next.js, use the Script element's nonce prop.
  • data-host-url on another address. Allow that address in connect-src too, or nothing is counted.

The browser console names any blocked address.

Single-page apps

No extra code is needed: route changes send a page view. The part after # is never sent. data-exclude-search="true" ignores the query string; data-auto-pageview="false" stops automatic page views so you call lundot.track() yourself. See Custom events and Navigation.

Count actions

Add data-lundot-event="signup" to an element, or call lundot.track("signup"). See Custom events.

Confirm it works

  1. Open your site, or choose Open under Check it works. Setup checks every 15 seconds; Check now checks at once. A Tag Manager tag gives "Could not see the tag", not "not found".
  2. On the first visit the row changes to Receiving data ("Last visit 14:02 on /your-page").
  3. Later, Settings, then Connections, shows "Last event", or "No events yet."

In the browser's Network panel, look for a POST to /api/send. 200 means received; other statuses are in Troubleshooting. No request at all: see Troubleshooting.

Each hit passes these checks in order before it counts:

Swipe sideways to see the whole diagram.

Each hit passes these checks in this order. A refused hit stores nothing.
The diagram as a list
  1. The visitor's browser loads script.js from your Lundot address.
  2. The script posts each page view or event to /api/send with the website id.
  3. Lundot checks the size (up to 64 KiB) and that the site is switched on and within its plan. Otherwise it answers 400, 402, 403 or 413 and stores nothing.
  4. It applies the site's privacy profile, trimming what is kept. A Global Privacy Control or Do Not Track signal means Strict.
  5. It checks that the hostname belongs to the site and that the website id exists. Otherwise it answers 403 or 400 and stores nothing.
  6. It checks the user agent. A bot is stored as a bot request, never as a visit.
  7. Everything else is stored as a visit, with a visitor id made from a salt that changes daily. The IP address gives a location and is then dropped.

A headless browser or a request with no user agent counts as bot traffic, so test in an ordinary window. Do Not Track and Global Privacy Control browsers are counted under Strict.

Size

Gzipped, the full script stays under 11 KiB and script.core.js under 5 KiB. The core version leaves out engagement, automatic link capture and performance collection. Setup uses script.js.

What the script collects

On Standard: page views and events, no persistent identifiers, no URL fragments or referrer query strings, and only the five utm_ campaign tags. See Tracking script.

  • DocsTracking script

    Every attribute of the Lundot tracking script, with values, defaults and effects, plus the three privacy profiles, consent and what the script sends.

  • DocsWeb analytics

    Visitors, visits, sources (including visits from AI), pages, locations, devices.

  • DocsCookies and consent

    Choose a tracking profile, connect analytics and replay consent, and learn when a banner may be needed.

  • DocsThe page report

    One row per path: AI requests, search, visits and conversions.