---
name: analytics
description: View counts and per-visitor breakdown for each share.
---

# Analytics

Every share has an analytics page that the owner can open from the dashboard. It shows two things: aggregate view stats, and a per-visitor breakdown.

## What is tracked

- **View count** — total views, deduplicated within a short window. Reloading the same page from the same browser does not double-count.
- **Unique-visitor count** — distinct visitors over the share's lifetime.
- **Per-visitor breakdown** — one row per unique visitor: a peppered IP fingerprint, the user-agent string, the first-seen timestamp, and the last-seen timestamp.

## How visitors are identified

We do not store raw IP addresses. For every view, we compute:

```
sha256(ip + VIEW_IP_PEPPER), truncated to the first 32 hex characters
```

`VIEW_IP_PEPPER` is a server-side secret. The 32-character hash is the per-visitor identifier on the analytics page. It is irreversible: it lets you tell whether two visits are from the same network, but it cannot be used to identify the person.

The same hash is used to deduplicate views within a window.

## Accessing analytics

### Web

On the dashboard, open the actions menu (`⋯`) on the share's row and pick **View analytics**. Or visit `/dashboard/shares/<id>/analytics` directly.

The page shows:

- Total views and unique visitors.
- A small chart of views over time (if there are enough data points).
- A table of visitors, sorted by last-seen, with the visitor hash, user-agent, first-seen, and last-seen columns.

### CLI

Not exposed yet. Use the web dashboard.

### API

Not exposed yet. The endpoint is on the roadmap for `/api/v1/shares/:id/analytics`.

## Who sees analytics

- **The share owner** — full access on the dashboard.
- **Anyone else** — no access. The analytics URL is owner-only; an anonymous request returns a redirect to sign in, and a signed-in non-owner gets a 404.

Visitors of a share see nothing. They cannot see the view count, who else has viewed, or any of the analytics data.

## Retention

Per-visitor records are kept while the share is alive. Soft-deleting a share keeps the analytics rows attached; hard-deletion (which runs on a 30-day cycle for soft-deleted shares) removes them along with the share.

## Next steps

- [Privacy policy](/privacy) — the full list of what we collect and why.
- [Web dashboard](/docs/web) — the actions menu that links here.
