# Cookieless web analytics: what it measures and what it does not

> Cookieless analytics tracks pageviews, sources, devices, and custom events without cookies or storing IP addresses.

**Cookieless analytics measures traffic, referrers, geographic locations, and custom conversion events without writing cookies to a visitor's device or storing their IP address.** It gives you the core traffic numbers you need to run a business—such as unique daily visitors, top referral sources, and high-converting pages—while sidestepping intrusive tracking mechanisms. However, without persistent identifiers or third-party cookies, it cannot track individuals across multiple distinct domains, maintain cross-device identity prior to user authentication, or build advertising profiles.

Here is an honest breakdown of how cookieless tracking operates under the hood, what data you can safely collect, what it leaves out, and how to query your metrics using thelastapi.

## How cookieless tracking works under the hood

Traditional web analytics drops persistent cookies on a user's browser to follow their browsing habits across months or different web properties. Cookieless analytics takes a privacy-first posture.

On thelastapi, the `analytics` resource is on by default for every project. It measures site traffic through a lightweight client tag without setting any cookies:

```html
<script defer src="https://thelastapi.dev/v1/script.js" data-key="vz_pk_..."></script>
```

When this snippet loads, visitor identity is handled in one of two ways:

1. **Local storage identifier (default):** A random identifier is placed in the browser's `localStorage`. This allows the script to identify a visitor across multiple days and network changes within that same browser, without setting an HTTP cookie.
2. **Daily-salted hashes (`data-no-storage`):** If you add the `data-no-storage` attribute to the script tag, `localStorage` is disabled completely. The server identifies unique visitors using a daily-salted hash. Under this setting, a returning visitor is counted again as a new visitor each day.

For geographical reporting, the server performs an on-the-fly lookup using [IP geolocation by DB-IP](https://db-ip.com). The visitor's raw IP address is never stored on disk or written to the database.

## What cookieless analytics measures

A privacy-focused setup still captures the essential operational data you need to understand audience growth and user behavior.

### Traffic and referral sources

The script captures standard navigation events, mapping referrers into clean names (such as **Google**, **ChatGPT**, or **Direct**). You get accurate metrics on:

- Total pageviews and unique visitors
- Entry pages and top-trafficked paths
- Referring platforms and search engines
- Visitor countries (resolved locally, without saving IPs)
- Device types and browsers

### Custom application events

You can send custom conversion signals directly from your frontend code. Each event takes a name and a JSON payload:

```js
// Send a custom event from the browser
vibiz('event', 'Signup', { plan: 'pro' });
```

Payloads are sent as `text/plain` JSON. An event payload can be up to 8 KB and support up to 30 scalar properties. You can also instrument events from your backend using [server-side event tracking](https://thelastapi.dev/blog/server-side-event-tracking) with `@vibiz/app`.

### Cross-session identity after sign-in

Cookieless setups do not attempt to guess visitor identities across devices prior to authentication. However, once a user signs into your application, you can explicitly connect their browsing history on that device to their account id:

```js
// Associate the browser's session with a verified user id
vibiz('identify', user.id);

// Clear identity when the user signs out
vibiz('identify', null);
```

When you call `vibiz('identify', user.id)`, the user becomes one recognized visitor across multiple devices, and their earlier unauthenticated visits in that browser join their profile.

## What cookieless analytics does not measure

Operating without persistent cookies or device fingerprinting introduces distinct technical boundaries:

| Metric or Capability | Cookieless with `localStorage` | Cookieless with `data-no-storage` | Traditional Cookie Tracking |
| --- | --- | --- | --- |
| **Pageviews & Referrers** | Yes | Yes | Yes |
| **Geographic Country** | Yes (IP not stored) | Yes (IP not stored) | Yes |
| **Returning Visitors (Multi-day)** | Yes | No (resets daily) | Yes |
| **Cross-Device Tracking (Pre-login)** | No | No | Sometimes (via device graphs) |
| **Cross-Domain Profiling** | No | No | Yes (via 3rd-party cookies) |
| **Stored IP Addresses** | No | No | Common |
| **Ad Retargeting Audiences** | No | No | Yes |

Cookieless analytics explicitly avoids:

- **Third-party cross-site tracking:** It cannot follow a user across independent domains owned by different companies to see what they browse elsewhere.
- **Persistent cross-network identity without storage:** If you use `data-no-storage`, returning visitors cannot be tracked across midnight boundaries, because the salt rotates every day.
- **Ad retargeting pools:** It does not feed commercial ad platforms or sync behavioral segments across external marketing networks.

## Reading analytics from the CLI and API

You can read traffic metrics directly through the `vibiz` CLI or the JSON API. Review [Analytics and replay](https://thelastapi.dev/docs/analytics) for full endpoint specifications.

To check visitors, top pages, and sources over the last 7 days:

```bash
vibiz analytics --period 7d
```

With HTTP via curl:

```bash
curl "https://thelastapi.dev/v1/projects/prj_123/analytics?period=7d" \
  -H "Authorization: Bearer $VIBIZ_API_KEY"
```

The endpoint returns an object containing `totals`, `timeseries`, `top_pages`, `sources`, `countries`, `devices`, and `events`.

You can also monitor traffic health within the broader context of your deployment. In console ▸ **Mission Control**, step 4 checks your traffic trends automatically. The system warns you if pageviews over the last 24 hours drop more than 60% below your 7-day daily average (once traffic averages 20 or more visitors a day). Learn more about system checks in [Mission Control and health checks](https://thelastapi.dev/docs/mission-control).

## Pairing cookieless analytics with session replay

Traffic counts indicate *how many* visitors arrived, but they do not reveal where users encounter broken UI elements. You can add the `replay` resource alongside your analytics:

```bash
vibiz add replay
```

When enabled, session replay captures user interactions in the browser. Replay uses the same script tag without requiring extra configuration. If your site needs explicit visitor consent, set `require_consent: true` in your project configuration and trigger the recorder manually:

```js
vibiz('replay', 'start');
```

To learn more about recording sessions while preserving user privacy, see [session replay for a small site: masked, cheap and useful](https://thelastapi.dev/blog/session-replay-small-site) and [add analytics to any site with one tag](https://thelastapi.dev/blog/add-analytics-any-site-one-tag).

## Adding analytics to a site hosted elsewhere

You do not need to host your application on thelastapi to use its cookieless analytics. You can track static sites, documentation portals, or backends hosted on external infrastructure:

```bash
# 1. Initialize a project with analytics only
vibiz init acme-docs --resources analytics

# 2. Register your domain running on an external host
vibiz domains add example.com --elsewhere

# 3. Retrieve the tracking snippet
vibiz analytics snippet
```

Paste the returned snippet tag into your site's `<head>`. Events are accepted only from the project's own verified domains (and its `vibiz.app` address), which keeps unauthorized sites from submitting garbage data against your site key.

Create your account at [thelastapi.dev/start](https://thelastapi.dev/start) to get your key and start building.

## Frequently asked questions

### Does cookieless analytics require a cookie banner?

By default, thelastapi uses a random id stored in the browser's localStorage rather than an HTTP cookie. If your target market requires consent for local storage identifiers, you can add the `data-no-storage` attribute to the script tag to switch to daily-salted hashes, or consult local privacy regulations regarding your specific storage use.

### How are countries determined if IP addresses are not stored?

Countries are resolved on the fly via a local database lookup using IP geolocation by DB-IP as requests arrive. The raw IP address is discarded immediately and is never written to server logs or databases.

### What happens if an event is sent from an unregistered domain?

The ingestion endpoint checks the request origin and returns an HTTP 403 `forbidden` status. Analytics events are only accepted from verified domains registered to your project or its default `vibiz.app` subdomain.

### How much does analytics tracking cost?

Analytics events and session replay recordings are recorded at $0. Replay session storage costs $0.023 per GB-month plus the standard margin (+20% today).

---

Published 2026-11-15 · https://thelastapi.dev/blog/cookieless-web-analytics
