Docs menu

Reference

Tracking script

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

On this page 6 sections

Configure the tracking script with data- attributes on its script tag. To install it, see Install the tracking script.

Attributes

Attribute Values Default What it does
data-website-id The site's website id (a UUID) None Required. Without it the script sends nothing and logs one console warning.
data-privacy strict, standard, consented standard The privacy profile. Use consented with a consent banner. Other values read as standard.
data-host-url A URL The address the script was loaded from Where the script sends data. The script adds /api/send.
data-auto-track false On No automatic page view, navigation or click tracking. lundot.track() still works.
data-auto-pageview false On No automatic page views, on load or navigation. lundot.track() still works.
data-exclude-search true Off Removes the query string from page and referrer addresses. See the warning below.
data-domains Hostnames separated by commas All Sends only when the page's hostname is listed. Exact match: list www.example.com and example.com separately.
data-do-not-track true Off Sends nothing from a browser that sends Do Not Track. Without it, such a browser is counted under Strict. Global Privacy Control is not covered.
data-tag Text, up to 50 characters None A label on every hit, to split data by deployment or template. A tag starting with =, +, - or @ gets every hit refused. Dropped under Strict.
data-distinct-id Text, up to 50 characters None Identifies the visitor. Only on consented after an analytics grant.
data-before-send The name of a function on window None Calls window[name](type, payload) before each send. Return the payload to send it, or null to drop it. May be asynchronous.
data-replays off On Stops replays from this tag. Not enforced: for that, turn off Record replays and heatmaps in Setup or Site settings.
data-heatmaps off On Stops heatmaps from this tag, likewise. With both off, the second file below is never loaded.
data-block-selector A CSS selector list None Elements left out of replays as empty boxes, added to the list in Site settings, Replays. See Session replay privacy.
data-performance true Off Sends page load measures (LCP, INP, CLS, FCP, TTFB) once per page. Full script only, and not under Strict.

Which file to load

Once a visitor agrees to replays, either script loads recorder.js from the same address (not when both data-replays and data-heatmaps are off or on Strict). Allow it in any Content-Security-Policy.

File Includes
script.js Page views, events, privacy controls, navigation tracking, engagement, outbound links, file downloads and performance collection
script.core.js The same, without engagement, automatic link capture and performance collection

Setup gives you script.js.

Excluded pages and domains

To exclude paths, do not load the script there, or return null from data-before-send:

<script>
  window.skipAdmin = (type, payload) =>
    new URL(payload.url, location.href).pathname.startsWith("/admin") ? null : payload;
</script>
<script defer src="https://your-lundot-address/script.js" data-website-id="your-website-id" data-before-send="skipAdmin"></script>

To restrict the script to some hostnames, use data-domains. The server also refuses other hostnames: see Add a site.

Privacy profiles

The profile sets what the script may collect. Choose it per site with Change on the Privacy profile row in Setup's Add the tracking script sheet, or in Site settings, Tracking. The server enforces it too, so an old or edited script cannot collect more. Switching and consent tools: Cookies and consent.

Strict Standard Consented
When it sends Always Always Always: as Standard until analytics consent, then as Consented
Persistent browser identifiers None None None, unless you identify visitors
Page address Path only, no query Path plus utm_source, utm_medium, utm_campaign, utm_term, utm_content As Standard before consent; after it, path plus campaign tags and ad click ids
External referrer Origin only Without its query Without its query
Page title, screen size, tag Removed Sent Sent
Event names Sent Sent Sent
Custom event properties Removed Sent Sent
Identify visitors Blocked Blocked Allowed after explicit consent
Engagement, link and download events Off On (full script) On (full script)
Performance data Off On if data-performance On if data-performance
Session replay Refused Needs separate consent Needs separate consent

Notes for every profile:

  • Fragments and referrer query strings are always removed. Outbound and download addresses are reduced to origin and path.
  • The script never sends credentials, and never reads or writes cookies or browser storage.
  • utm_term and utm_content are kept only up to 100 characters of letters, digits, spaces and . _ ~ + -; anything else, such as an email address, is dropped.
  • The campaign tags kept under Consented are utm_source, utm_medium, utm_campaign, utm_term, utm_content, gad_source, oppref and these click ids: gclid, gbraid, wbraid, dclid, msclkid, fbclid, ttclid, twclid, li_fat_id and yclid.
  • Replay masking is covered in Session replay privacy. Under Strict no replay is recorded.

Do Not Track and Global Privacy Control

A browser that sends Global Privacy Control or Do Not Track is counted under Strict on every profile, even after an analytics grant. Under Do Not Track a consent("replay") still records. Under Global Privacy Control a replay grant counts only when window.lundot.explicitConsent lists "replay", meaning the visitor switched replay on themselves; the server refuses other recordings sent with Sec-GPC: 1.

A consented site counts visits before consent as Standard does. Consent adds only identification (data-distinct-id, lundot.identify()) and the full campaign tags and ad click ids. Your consent tool calls:

(window.lundot ??= { consented: [] }).consented.push("analytics"); // the visitor agreed
window.lundot?.revoke?.("analytics"); // the visitor withdrew
  • A grant upgrades the hits that follow. A landing's ad click id is kept only if consent arrives before that page view is sent (pushed before the script loads, or already in dataLayer).
  • Revoking drops the identity and its session token at once and returns to the Standard form. Nothing is queued.
  • On Standard and Strict sites, revoke("analytics") is the visitor's opt-out: it stops collection until a later consent("analytics").
  • Consent is held in memory only: call the push line on each load, before or after the script loads. Do not call window.lundot.consent before it loads, or assign window.lundot.consented = [...] (it throws when window.lundot does not exist).
  • Replay uses its own purpose: push "replay" the same way.

On consented sites the script also reads Google Consent Mode update commands in window.dataLayer: analytics_storage: "granted" calls consent("analytics"), "denied" calls revoke("analytics"). Consent read this way never allows identification or replay.

What the script sends on its own

  • Page views, on load and on navigation (see below).
  • engagement, with engaged_ms (visible time) and scroll_depth (percentage), when the page is hidden, left or navigated.
  • outbound_click, with the link's origin and path, when a visitor clicks a link to another host.
  • file_download, with the link's origin and path, for links with a download attribute or a common file type such as pdf or zip.

Link events do not capture link text or form values. Strict turns these events off, and script.core.js omits them.

Each hit also carries a small lundot object (browser origin, webdriver flag, privacy profile). It counts toward the property limits.

History navigation (pushState, replaceState, popstate) sends a page view about 300 ms after the address changes, unless data-auto-pageview="false". The part after # is never sent, so hash routes are not told apart.

Where it sends data

The script sends nothing from localhost, 127.0.0.1, ::1 or *.localhost. Elsewhere it posts JSON to /api/send on data-host-url or its own address, without credentials. A request over 64 KiB is refused. After a 402 or 403 the script stops sending for the rest of the page. See Troubleshooting.

Supported global functions

Function Purpose
lundot.track(...) Send a page view or an event. See Custom events.
lundot.identify(...) Attach an id and properties to the visitor. consented profile only.
(window.lundot ??= { consented: [] }).consented.push(purpose) Grant "analytics" or "replay". Safe before and after the script loads.
window.lundot.revoke(purpose) Withdraw it. Call as window.lundot?.revoke?.(purpose).

TypeScript

Copy /lundot.d.ts from your Lundot address into your project and include it in tsconfig.json. It declares window.lundot with every member optional, as the script may not have loaded: window.lundot?.track?.("signup").