# Product analytics you can self-host

Product analytics measures what users do inside your product: funnels, retention, user flows, and per-person profiles. Pug is open-source and self-hostable.

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

Funnels, retention, user flows, and a profile for each person, built from the events your product sends. Pug is open source: run it on your own servers, or on Pug Cloud, free up to 100k events a month.

- Seven insight types
- One profile per person
- AGPL-3.0

## What product analytics is

What people do inside your product, tied to each person over time.

Product analytics records what people do in your product as events and ties each one to the person who did it. That answers questions a page count can’t: which steps people complete, where they drop off, and whether they come back. [Web analytics](https://pug.sh/learn/product-analytics-vs-web-analytics) counts traffic instead, and most teams run both. [How product analytics works](https://pug.sh/learn/open-source-product-analytics) walks through the event, the identity behind it, and the query each insight type runs.

## Seven insight types

Each one filters and breaks down by any property, including the ones you send yourself, over events you have already collected.

### Trends

Any event over time, as a count, unique users, or the sum, average, min, or max of a number. Break down by up to five properties.

### Funnels

Conversion through ordered steps, with the drop-off and the average time between each.

[Funnel analysis, defined](https://pug.sh/glossary/funnel-analysis)

### Retention

Of the people who did a start event, how many did a return event in each period after, by cohort.

[Retention cohorts, defined](https://pug.sh/glossary/retention-cohort)

### Segmentation

One number, such as signups or revenue, split by a property like country or plan. Made for KPI tiles.

### User flow

A Sankey of the paths people take from one event to the next, and where they leave.

[User flow analysis, defined](https://pug.sh/glossary/user-flow-analysis)

### Top K

The most common values of any property, such as pages, referrers, or products, with the rest as “others”.

### Map

One metric per country, such as events, unique users, or the sum of a number, for every country with traffic.

- [See the insights in detail](https://pug.sh/analytics)
- [Build a dashboard](https://pug.sh/analytics-dashboard)
- [How the MCP server works](https://pug.sh/mcp)

## Three ways events get in

Autocapture starts with init(); the other two are calls you add where they matter.

### Autocapture

On the web, `init()` starts capturing page views, clicks, scrolls, form submits, and rage and dead clicks.

### Custom events

Call `track()` for actions specific to your product, like `signup` or `order_completed`, with any properties.

### Identity

`identify()` at sign-in merges anonymous activity into the person’s profile. More in [user analytics](https://pug.sh/user-analytics).

- [Web, Android, iOS, Flutter, Node, Go & Ruby SDKs](https://pug.sh/sdks)
- [Plan your events](https://pug.sh/learn/event-tracking-open-source)

## Run it on your own servers

Pug self-hosts as one Go binary and four stores: PostgreSQL, ClickHouse, NATS, and Dragonfly (or any Redis 7+). On a small node, pug start runs the server and every worker in one process.

- [Self-hosting guide](https://docs.pug.sh/self-hosting)
- [View source](https://github.com/pug-sh/pug)

* [Self-hosted analytics](https://pug.sh/self-hosted-analytics)
* [The best open source analytics tools](https://pug.sh/open-source-analytics)
* [Pricing](https://pug.sh/pricing)

## Product analytics tools, compared

Each comparison includes where the other tool is the better choice.

- [Pug vs PostHog](https://pug.sh/compare/posthog-alternative): A focused product-analytics tool vs a broad platform with replay, flags, and experiments.
- [Pug vs Mixpanel](https://pug.sh/compare/mixpanel-alternative): Open and self-hostable vs a proprietary, cloud-only product-analytics SaaS.
- [Pug vs Google Analytics](https://pug.sh/compare/google-analytics-alternative): Events tied to people, unsampled, on servers you choose.

* [Best product analytics tools](https://pug.sh/learn/best-product-analytics-tools)
* [PostHog alternatives](https://pug.sh/learn/best-posthog-alternatives)
* [Mixpanel alternatives](https://pug.sh/learn/best-mixpanel-alternatives)

## Frequently asked

### What is product analytics?

Product analytics measures what people do inside your product (the events they fire, the funnels they move through, whether they come back), tied to a person over time. It answers questions that page counts can’t, such as where users drop off and which features bring them back.

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

Web analytics measures traffic: pageviews, sources, and devices. Product analytics measures behaviour (funnels, retention, user flows) attributed to individual users and cohorts. Most teams run both; see the full breakdown in product analytics vs web analytics.

### Is Pug a free product analytics tool?

Yes. Self-host under AGPL-3.0 free forever with no event limits, or use the managed cloud, free up to 100,000 events a month. There’s no per-event bill when you run it yourself.

### What is the best open source product analytics tool?

It depends on how much you want to operate. PostHog is a broad platform; Pug is a focused, self-hostable tool that runs as one Go binary and four stores. The comparison pages and tools roundup walk through the trade-offs.

### Can I self-host product analytics?

Yes. Self-hosted under AGPL-3.0, Pug keeps every event on your own infrastructure. See self-hosted analytics for the stack.

### Can an AI agent query my product analytics?

Yes. Pug’s MCP server lets Claude, ChatGPT, Cursor, or any other MCP client ask about trends, funnels, retention, user paths, top lists, and country maps, and create or edit a dashboard with upsert_dashboard, its one write tool. It queries the same API the dashboard does, so its numbers match yours.
