# One timeline per person

User analytics measures people and cohorts, not aggregate pageviews. Pug unifies anonymous and signed-in activity into one profile per person. Open source.

Source: https://pug.sh/user-analytics

User analytics follows people instead of pages: each person’s events, sessions, and traits, in order and across devices. Pug merges anonymous and signed-in activity into one profile when someone signs in.

- Unified profiles
- Anonymous → identified
- Cohorts and traits
- Self-host under AGPL-3.0

## What user analytics means

Behavior attributed to one person over time.

[Web analytics](https://pug.sh/learn/product-analytics-vs-web-analytics) tells you how many sessions hit a page. User analytics tells you **who** did **what**, in order, across devices, from a person’s first anonymous visit through sign-up. [Product analytics](https://pug.sh/product-analytics) builds funnels and retention on top of it.

## Anonymous activity becomes one person

Call identify() at sign-in and Pug merges the history itself; there is no stitching job to run.

- Before sign-in, events collect under an anonymous ID
- identify() at sign-in merges that history into their profile
- The same user ID on web, Android, and server is one person
- Traits such as plan or email filter every insight

### The first visit and the upgrade, on one profile

Events from before sign-in stay on the timeline: `identify()` joins the anonymous history to everything after it.

- Each device keeps its own anonymous ID until sign-in
- Server SDKs name the user ID on every call, with no anonymous step
- On the web, events from before consent are never linked

*A single user_123 profile timeline: page_view, scroll, and add_to_cart were tracked anonymously before sign-in, then identify('user_123') joins that history to the signup and order_completed events that follow*

## What per-person data adds

Once events belong to people, you can count people instead of pageviews.

### Per-person timelines

One person’s sessions, events, and traits in one view, newest first. An AI agent reads the same timeline over [Pug’s MCP server](https://pug.sh/mcp).

### Cohorts and retention

[Retention](https://pug.sh/analytics) groups people by when they first did something, then counts how many come back in each period after.

### Traits as filters

Plan, country, email, or any trait you set lives on the profile and works as a filter in every insight.

- [Funnels, retention & segments](https://pug.sh/analytics)
- [Product analytics overview](https://pug.sh/product-analytics)

## Where profiles are stored

Self-hosted, every profile stays in your own infrastructure. On Pug Cloud, profiles are stored in the EU.

- [Self-hosted analytics](https://pug.sh/self-hosted-analytics)
- [Privacy-first analytics & GDPR](https://pug.sh/learn/privacy-first-analytics)
- [Identify users from any SDK](https://pug.sh/sdks)

## What people ask about user analytics

### What is user analytics?

User analytics measures behaviour at the level of an individual person and cohort, rather than aggregate page totals. It ties every event to a profile, so you can answer questions like “what did this user do before they upgraded?” or “do users from this cohort stick around?” It’s the per-person side of product analytics.

### How is user analytics different from web analytics?

Web analytics counts traffic (sessions, pageviews, sources), usually anonymised and aggregated. User analytics attributes behaviour to a person over time and across devices, which is what funnels, retention, and profiles need.

### How does identity resolution work?

Before sign-in, events accrue to an anonymous ID. When you call identify(userId), that anonymous history merges into one profile, so a user’s pre-signup activity isn’t lost. The same person stays unified across web, mobile, and server.

### Does user-level tracking work with privacy and GDPR?

Self-hosting keeps every profile on your own servers, which simplifies data residency and GDPR questions, and there’s no ad-network data sharing. It isn’t automatic compliance, but it removes the third-party sharing that complicates most setups. See privacy-first analytics.

### Can I self-host user analytics?

Yes. Pug runs as one Go binary with four stores (PostgreSQL, ClickHouse, NATS, and Dragonfly or any Redis 7+), so every profile and event stays inside your infrastructure. See self-hosted analytics.

### Can an AI agent look up a user?

Yes. Over Pug’s MCP server, an agent in Claude, ChatGPT, or any other MCP client looks a person up by their Pug ID or by your own user ID, then reads their timeline, sessions, and stats. It has no tool for erasing a person.
