Pageview Tracking

Statalog begins recording pageviews the moment the tracker script loads on your page. No configuration is required beyond the one-line snippet. This article explains what data is captured, how visitor identification works, and how sessions are calculated.

What triggers a pageview

A pageview is recorded each time the tracker script executes. This happens in two scenarios:

  1. A full page load — the visitor loads any page that contains the snippet.
  2. A client-side navigation event — in single-page applications, whenever history.pushState or popstate fires (see SPA support below).

What data is captured

For each pageview, Statalog records the following:

Field Source Notes
URL window.location.href Full URL including path and query string
Referrer document.referrer The page the visitor came from
Browser User-Agent string parsing e.g. Chrome 124, Safari 17
Operating system User-Agent string parsing e.g. macOS, Windows, Android
Device type User-Agent string parsing Desktop, mobile, or tablet
Screen size window.screen.width/height Used for heatmap resolution bucketing
Country GeoIP lookup on server Derived from IP address; IP is then discarded
Language navigator.language e.g. en-US, de, fr

The raw IP address is used only for the GeoIP lookup and for computing the visitor ID (described below). It is never stored in the database.

How visitor identification works

Statalog does not use cookies. Instead, each request is assigned a temporary visitor ID using the following method:

  1. The server takes the visitor's IP address and User-Agent string.
  2. It concatenates them with a secret daily-rotating salt.
  3. It computes HMAC-SHA256(IP + UA + salt).
  4. The resulting hash is stored as the visitor ID for that pageview.

Because the salt changes every 24 hours, the same visitor will receive a different ID each day. This means:

  • There is no persistent cross-session tracking — Statalog cannot tell whether Monday's visitor and Tuesday's visitor are the same person.
  • The hash cannot be reversed to recover the original IP address or user-agent.
  • No data is ever written to the visitor's browser.

This design makes Statalog compliant with GDPR, CCPA, and ePrivacy regulations without requiring a consent mechanism.

How sessions are calculated

A session is a group of one or more pageviews from the same visitor in a continuous browsing period. The rules are:

  • A new session starts when a visitor's first pageview is recorded.
  • Each subsequent pageview from the same visitor ID within 30 minutes of the previous one extends the current session.
  • If more than 30 minutes pass without a pageview, the next visit from that visitor ID starts a new session.
  • Because the visitor ID resets daily, a new day always starts a new session regardless of the 30-minute rule.

Bounce rate

Bounce rate is the percentage of sessions that contained exactly one pageview. A visitor who lands on your homepage and leaves without clicking anything counts as a bounce. A visitor who navigates to a second page does not.

Bounce rate is calculated at the session level, not the page level.

SPA support

For single-page applications built with React, Vue, Angular, Svelte, or any framework that uses the History API, Statalog listens for history.pushState and popstate events. Each time the URL changes via one of these events, a new pageview is recorded automatically.

No additional configuration is required. The tracker handles hash-based routing (#/page) as well, recording a pageview when the hash changes.

Cross-domain tracking

If your site spans multiple domains — for example, your marketing site at example.com and your app at app.example.io — you can link them using the data-domain attribute:

<script
  async
  src="https://cdn.statalog.com/st.js"
  data-site="ST-XXXXXXXXXXXXXXX"
  data-domain="example.com"
></script>

Add this attribute on both domains, using the same data-site value. Statalog will attribute cross-domain visits to a single session where possible, so a visitor who moves from the marketing site to the app does not appear as a new session.

Excluding your own visits

To stop recording your own browsing in your site's reports:

Method 1 — Query parameter flag

Visit any page on your site with ?statalog_ignore=true appended to the URL:

https://example.com/?statalog_ignore=true

The tracker will store a flag in the browser's localStorage. From that point on, no pageviews will be sent from that browser, even on future visits.

Method 2 — Localhost filtering

Pageviews originating from localhost, 127.0.0.1, or private IP ranges (RFC 1918) are automatically discarded by the server and never appear in reports. Development environments are excluded without any additional steps.

To clear the ignore flag and resume tracking a browser, visit any page with ?statalog_ignore=false.