Skip to content
LeitaguDocs

Loading…

Pages

Platform

Traffic analytics

How Leitagu counts visits to the shop and the knowledge hub without cookies, what the admin app's Analytics page shows, what each number means, and what is not stored.

Updated 20 October 2026View as Markdown

The Leitagu team sees how many people visit the shop and the knowledge hub, where they come from and which pages they read, on the Analytics (Analüütika) page in the admin app. Leitagu counts these visits itself, in its own database, with no outside analytics service. It sets no cookies and stores no account ids, addresses or query strings, so shoppers don't have to agree to anything and the numbers include everyone.

This page is about traffic: page views. What shoppers do with products (impressions, opens, store visits) is a separate system for stores, described in Analytics definitions.

Who can see it

Owners and admins, through the analytics.view permission (see Staff roles and permissions). The page shows totals only; nothing on it identifies a person.

How a visit is counted

  • What counts. Each page a visitor opens in the shop (leitagu.ee) or the hub (docs.leitagu.ee). A small script on every page reports the view when the page loads and when the visitor moves to another page within the site. A change only in filters or sort order, which keeps the same path, is not a new view.
  • Where it goes. The script sends the view to the shop's /api/collect. The hub has no database, so its views go there too.
  • Visitors without cookies. The server makes a visitor code from a hash of the visitor's address, their browser's identification and a random value (the salt) that changes every day. The same person on the same day gets the same code, so they count as one visitor. The next day they get a new code. The salt is deleted when the day ends, so no one, including Leitagu, can work the code back out or link two days.
  • A visitor is a visitor on one day. Someone who visits on three days counts as three visitors in a 30-day period. Two people sharing one address and the same browser version on the same day count as one.
  • Not counted: crawlers and link previews (search engines, Slack, WhatsApp, Facebook and similar), prefetches, requests without a browser identification, requests from other sites, and anything over 600 views an hour from one visitor. The admin, partner and CRM apps are not counted.

What is stored

Stored How
Site Shop or hub
Path The page's address without the query string. Ids are replaced with :id, so /chats/<id> is stored as /chats/:id and no chat or room can be found from it
Referring site Only another site's name (for example google.ee), and only for the first page of a visit. Our own sites are not stored
Campaign tags utm_source, utm_medium and utm_campaign from the address, if present. Nothing else from the query string is kept
Device, browser, operating system Broad names only: phone, tablet or computer; Chrome, Safari, Firefox, Edge…; iOS, Android, Windows, macOS…
Signed in Whether the visitor was signed in to the shop, yes or no. Not who
Visitor code The daily hash described above
Time When the view was recorded

Not stored: the address (IP), the full browser identification, account ids, email addresses, the rest of the query string, cookies.

Page views are deleted after 400 days, so the last year can still be compared with the one before.

The Analytics page

The page shows a period of the last 7, 30 or 90 days (30 by default), for both sites or one. Like the partner app's periods, a period is a rolling window up to now, and days are calendar days in Estonian time.

Number Estonian Definition
Visitors Külastajad Distinct visitor codes in the period: one per visitor per day
Page views Lehevaatamised Page views recorded in the period
Views per visitor Vaatamisi külastaja kohta Page views ÷ visitors

Each is compared with the period of the same length just before, as with the partner app's numbers.

  • By day: visitors or page views per day, with a table of both.
  • Top pages: the ten pages with the most page views, with visitors and views. A page without an id links to the live page.
  • Sources: visitors by where they came from. A campaign's utm_source comes first; otherwise the referring site, with well-known sites grouped by name (google.ee and google.com are both Google; also Bing, DuckDuckGo, Facebook, Instagram, LinkedIn, X, YouTube, ChatGPT, Claude and Perplexity). A visitor who came from two sources on one day counts under both. Visitors with no source that day are Direct or unknown: they typed the address, used a bookmark, or came from an app that doesn't say where from.
  • Campaigns (utm): visitors and page views per source, medium and campaign tag.
  • Devices, browsers and operating systems: visitors and page views for each.

Add campaign tags to links you share, so their visits show under Campaigns and Sources. For example, a link in a newsletter:

https://leitagu.ee/catalogue?utm_source=newsletter&utm_medium=email&utm_campaign=autumn-2026

Tags are stored in lower case. Use the same spelling every time, or they show as separate rows. The catalogue keeps the tags when it tidies an address into its canonical form, so a tagged link to a filtered catalogue page is still counted under its campaign.

How it is built

  • packages/core/src/shared/traffic.ts: pure helpers that reduce a view to what is stored (path, referrer, campaign tags, device, browser, source names), covered by unit tests.
  • packages/core/src/server/traffic.ts: recording (recordPageView()), the daily salt, deleting old data and the page's queries (trafficReport()).
  • apps/web/src/app/api/collect/route.ts: the endpoint. It accepts views from the shop and the hub's address only.
  • packages/ui/src/PageViews.tsx: the script, included in the shop's and the hub's root layouts. It uses sendBeacon, so the hub can send to the shop without a CORS preflight.
  • Tables: page_views, and traffic_salts for the day's salt.

Planned

  • Product usage for the team: signup, verification, chats and searches that find nothing, as funnels and weekly retention.
  • A consent banner. With consent, a cookie would let the page count returning visitors and follow a visit through to signup; without it, counting stays as described here.