Skip to content

Install the script

One script tag of about 1 KB counts page views, custom events, and Web Vitals. Paste it once, and we confirm the first page view within seconds.

Before you start

You need a site in Lyli. Add its domain and reporting time zone at app.lyli.io/sites/new. Each site gets an ID that starts with s_, and its tag, with the ID filled in, is in Settings › Install.

Add the tag

Paste this before </head> on every page, or once in your app’s root layout. It runs after the page is parsed and doesn’t block rendering. Route changes in single-page apps are tracked automatically.

index.html
<script defer src="https://app.lyli.io/t.js" data-site="s_k3m9x2p7qa"></script>

s_k3m9x2p7qa stands for your site’s ID. Custom events and revenue have their own guide:Send custom events

Tag options

The tag works as it is. The script reads only its three data- attributes; defer is for the browser.

AttributeWhat it does
deferRuns the script after the page is parsed, so it doesn’t block rendering. Keep it.
data-siteYour site’s ID, starting with s_.
data-rememberOptional. Recognizes returning visitors across days: the script keeps a random ID in the browser’s storage, so in the EU and UK you need the visitor’s consent. Turn on Recognize returning visitors in the site’s settings, then add this attribute only for visitors who agree, for example through your consent tool; the tag on Install leaves it out. Without it, they get a daily code. See Recognize returning visitors.
data-apiWhere events are sent. Set it only with Via your domain: the path on your domain that forwards them to us.

Exclude your own visits

Run localStorage.setItem("_aoff", "1") in your browser’s console on your site. The script then sends nothing from that browser.

Replays and heatmaps use a second script, set up in Settings › Recording. It waits for the visitor’s consent by default. Consent for replays and heatmaps

Check that it works

Open Settings › Install for your site, then load any page of your site in another tab. Within a few seconds Install says the first page view was received. If the site’s Individual visits is on, it also shows that page view’s time, page, location, browser, device, source, and whether it came through your domain. With it off, the default, Install says only when the latest page view came.

Example data · Settings › Install, with the first page view from new-site.example

If no page view shows up

If a minute passes without a page view, check these:

  • The tag is on the deployed site, not only on your machine.
  • data-site is exactly your site’s ID.
  • A content blocker in your own browser may stop the script. Try another browser, or set up Via your domain.
  • A Content-Security-Policy must allow app.lyli.io in script-src and connect-src.
  • Page views from an address your site doesn’t count, such as a staging domain or localhost, are turned away. Settings › General › Hostnames decides which addresses count (Choose which hostnames count).

What we keep

Cookieless by default: the script sets no cookies and stores nothing in the browser. Whether you need your visitors’ consent even so depends on the country; in Sweden and Germany, assume you do (consent, by place).

PageThe path only. The script sends the full address; we drop the query string and keep campaign tags separately, with email addresses replaced, phone numbers and IP and MAC addresses hidden, and IDs turned into short codes.
ReferrerThe script sends the referring address; we keep only the source it names.
DeviceDevice type, browser, and operating system, worked out on our servers. We don’t keep the user-agent string.
LocationCountry and city, rounded to about 11 km. We never store IP addresses in our database.
Web VitalsHow fast each page loads, responds, and settles, one set per page view.
Custom eventsThe names and properties you send, kept as you send them.
Visitor codeA daily code that can’t be followed from one day to the next. Nothing is stored in the browser, unless the site recognizes returning visitors.

We never keep query strings, full referrer addresses, IP addresses, user-agent strings, or exact locations in our database; our hosting provider’s request logs keep IP addresses for about 7 days. Don’t send personal data in custom events.

What counts toward usage

Plans are sized by what a workspace records in a calendar month, across all its sites, links, and pixels.

CountsPage viewsCustom events you sendLink clicks and pixel loads
Never countsWeb VitalsJavaScript errors, from e.jsAPI requests and MCP callsTraffic identified as botsHistory imported from Google AnalyticsPixel loads through mail providers’ image proxiesPage views from hostnames your site doesn’t count