# Open-source product analytics

Open-source product analytics with unified profiles: autocapture, trends, funnels, retention, and user flows. Self-host under AGPL-3.0, or start free on Pug Cloud.

Source: https://pug.sh/

AI crawler reports are out

- [Start free](https://app.pug.sh)
- [Live demo](https://demo.pug.sh "Open the live demo dashboard")

Pug tracks what people do on your website, in your apps, and on your servers, and shows it as trends, funnels, retention, and user flows, with one profile per person. It runs without cookies until a visitor consents.

- Free up to 100,000 events a month
- Self‑host under AGPL-3.0
- EU‑hosted cloud

SDKs for web, mobile, and server

- Web
- Android
- iOS
- Flutter
- Node
- Go
- Ruby

[Every SDK](https://pug.sh/sdks)

## Seven insight types. Filter and break down any of them by any property you send.

Nothing has to be set up in advance: pick the events and a date range, and the chart covers everything already stored.

### 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.

### Retention.

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

### User flow.

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

### Segmentation.

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

### 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.

- [What product analytics measures](https://pug.sh/product-analytics)
- [Funnel analysis, explained](https://pug.sh/glossary/funnel-analysis)

## One profile per person. Their devices merge into it when they sign in.

A profile shows one person’s events, sessions, and traits, with their latest location, device, and browser.

- 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

[How identity resolution works](https://pug.sh/glossary/identity-resolution)

## Watch events arrive. Each one reaches the map in seconds.

Filter the stream by event, device, or country, and click a visitor to see their session and open their profile.

- Check that a new event fires, seconds after you deploy it
- Watch a launch: how many people, from where, on which pages
- Filter to one event and see the first people use a new feature

[Live, insights, and profiles in detail](https://pug.sh/analytics)

## Pin insights to a dashboard. Every tile shares the board’s date range.

Each tile keeps its own chart and filters, so one board can hold daily signups, a checkout funnel, and top pages side by side. Over MCP, an AI agent can also build a board or add tiles to one.

- KPI, line, area, bar, table, and Sankey tiles
- A filter bar that narrows every tile at once
- A comparison with the previous period on any tile
- Thresholds that color a KPI when it crosses a limit
- A public, read-only link to share the board

[More on dashboards](https://pug.sh/analytics-dashboard)

## Ask an AI agent about your analytics. It sees only what you can see.

Connect Pug from Claude’s connectors directory or ChatGPT’s plugins, or add it to Claude Code, Codex, Cursor, or any other MCP client and sign in. Then ask how signups moved last week, or what one customer did before they churned.

- It reaches your orgs when you sign in, or one project with a key
- It can’t erase a person, send events, or delete a dashboard
- It queries the same API you do, so its numbers match yours

[How the MCP server works](https://pug.sh/mcp)

## See which AI products read your site. Your server reports them, since most crawlers never run JavaScript.

Add `@pug-sh/crawlers` to a Cloudflare Worker, a Next.js proxy, or an Express app, or send one POST from any other server. It reports known crawlers only, never your visitors, and each request counts as an event.

- Requests by purpose: answers, search, training, and SEO
- An IP check that catches scrapers posing as GPTBot
- The pages crawlers read, and the ones that returned errors
- The visits ChatGPT, Perplexity, Claude, and Gemini send you

[How crawler reporting works](https://docs.pug.sh/crawlers/)

## Nothing is stored on the device until a visitor consents. Pug Cloud runs in the EU.

### Cookieless by default

Until a visitor consents, they are counted with a server-side hash instead of a cookie. Its salt is deleted every day, not rotated, so today’s visitors can’t be linked to yesterday’s.

### Consent from your banner

Wire your banner to three states: granted, cookieless, or denied. Events from before consent stay anonymous, and nothing links them to the person later.

### Erasure that hard-deletes

One API call erases a person by profile ID or by your own user ID. Their events, sessions, aliases, and profile are hard-deleted from ClickHouse and Postgres, and a request ID tells you when it’s done.

- [Privacy & GDPR](https://pug.sh/learn/privacy-first-analytics)
- [How cookieless identity works](https://pug.sh/learn/cookieless-analytics)

## Start tracking in two lines. Autocapture does the rest.

Call track() for the events specific to your product, and identify() when someone signs in.

### Web

Install

`npm install @pug-sh/browser`

Initialize: once, as the page loads

```typescript
import { init, identify, track } from '@pug-sh/browser'
init('your-project-id', { apiKey: 'pub_your_key' })
```

Track and identify

```typescript
identify('user_123', { email: 'ada@example.com' })
track('signup', { plan: 'pro' })
```

Captured automatically: from init() on

- `page_view`: each page load and route change
- `click`: the element’s tag, id, class and own text
- `scroll`: how far down the page, in percent
- `form_submit`: each submit, after a form_start
- `rage_click`: four fast clicks in one spot
- `dead_click`: a click that changed nothing

Each one arrives with its location (country, region, city), device, browser, and any UTM parameters.

### Android

Install: in build.gradle.kts

`implementation("sh.pug:android:0.2.1")`

Initialize: once, in Application.onCreate()

```kotlin
import sh.pug.android.Options
import sh.pug.android.Pug
Pug.init(this, "your-project-id", Options("pub_your_key"))
```

Track and identify

```kotlin
Pug.identify("user_123", mapOf("plan" to "pro"))
Pug.track.purchase(amount = 49.0, currency = "USD")
```

Captured automatically: from init() on

- `app_open`: the app comes to the foreground
- `app_close`: the app leaves the foreground
- `screen_view`: each activity shown, named by its class
- `app_install`: the first launch, with the store it came from
- `app_update`: the first launch of a new version

Each one arrives with its location, device model, Android version, app version, locale, and time zone.

### iOS

Install: in Xcode: File > Add Package Dependencies

`https://github.com/pug-sh/sdk-ios`

Initialize: once, as the app launches

```swift
import Pug
do {
  try Pug.initialize(projectId: "your-project-id", options: Pug.Options(apiKey: "pub_your_key"))
} catch {
  assertionFailure("Pug was not started: \(error)")
}
```

Track and identify

```swift
Pug.identify("user_123", traits: ["plan": "pro"])
Pug.track.purchase(amount: 49.0, currency: "USD")
```

Captured automatically: from init() on

- `app_open`: the app comes to the foreground
- `app_close`: the app goes to the background
- `screen_view`: each view controller, and SwiftUI views you name
- `app_install`: the first launch, with App Store or TestFlight
- `app_update`: the first launch of a new version

Each one arrives with its location, device model, iOS version, app version, locale, time zone, and network type.

### Flutter

Install

`flutter pub add pug_flutter`

Initialize: once, at startup

```dart
import 'package:pug_flutter/pug_flutter.dart';
await Pug.init('your-project-id', const PugOptions(apiKey: 'pub_your_key'));
```

Track and identify

```dart
await Pug.identify('user_123', traits: {'plan': 'pro'});
Pug.track.signup(extras: {'plan': 'pro'});
```

Captured automatically: from init() on

- `app_open`: the app comes to the foreground
- `app_close`: the app goes to the background
- `screen_view`: each route change, once PugRouteObserver is added
- `app_install`: the first launch on a device
- `app_update`: the first launch of a new version

Each one arrives with its location, device model, OS version, app version, locale, and network type.

### Node

Install

`npm install @pug-sh/node`

Initialize: once per process

```typescript
import { Pug } from '@pug-sh/node'
const pug = new Pug({ apiKey: process.env.PUG_PRIVATE_KEY })
```

Track and identify

```typescript
pug.track('user_123', 'order_completed', { amount: 49.0 })
await pug.identify('user_123', { email: 'ada@example.com' })
```

On a server: nothing is captured on its own

- Each event is a track() call that names the user
- Events carry no location, since the request comes from your server, not the visitor
- Closing the client on shutdown sends whatever is still queued

Read a profile: with the same private key

```typescript
const profile = await pug.profiles.getByExternalId('user_123')
```

### Go

Install

`go get github.com/pug-sh/sdk-go`

Initialize: once per process

```go
import pug "github.com/pug-sh/sdk-go"
client, err := pug.New(pug.Options{APIKey: os.Getenv("PUG_PRIVATE_KEY")})
if err != nil {
    log.Fatal(err)
}
```

Track and identify

```go
defer client.Close(ctx)
client.Track("user_123", "signup", pug.String("plan", "pro"))
client.Identify("user_123", pug.Email("ada@example.com"))
```

On a server: nothing is captured on its own

- Each event is a track() call that names the user
- Events carry no location, since the request comes from your server, not the visitor
- Closing the client on shutdown sends whatever is still queued

Read a profile: with the same private key

```go
profile, err := client.Profiles.GetByExternalID(ctx, "user_123")
```

### Ruby

Install

`bundle add pug-sh`

Initialize: once per process

```ruby
require "pug"
pug = Pug::Client.new(api_key: ENV.fetch("PUG_PRIVATE_KEY"))
```

Track and identify

```ruby
pug.track("user_123", "order_completed", amount: 49.0)
pug.identify("user_123", email: "ada@example.com", plan: "pro")
```

On a server: nothing is captured on its own

- Each event is a track() call that names the user
- Events carry no location, since the request comes from your server, not the visitor
- Closing the client on shutdown sends whatever is still queued

Read a profile: with the same private key

```ruby
profile = pug.profiles.get_by_external_id("user_123")
```

[How autocapture works](https://pug.sh/glossary/autocapture)

## Run it on your servers, or use ours. Pug Cloud runs the same open-source code.

**Clients**

- SDKs: track() and identify()
- Dashboard: Static files on any web server

pug: One Go binary

**Processes**

- `pug server` (:3000)
- `pug worker events` (scales out)
- `pug worker profile` (identify, alias, upsert)
- `pug worker compliance` (erasure)
- `pug worker email` (sign-in links)

**Backing stores**

- Dragonfly (or Redis 7+): The daily salt, kept off disk
- NATS (JetStream): Queues every event
- ClickHouse: Every event
- PostgreSQL (15+): Accounts, boards, and profiles

### Run it as one process or many.

`pug start` runs the server and every worker in one process, on a small node. In production, each role is its own image, for amd64 and arm64.

[Self-hosting docs](https://docs.pug.sh/self-hosting/)

### Point the SDKs at your server.

Set `endpoint` to its URL in any of the seven SDKs. Leave it out, and events go to Pug Cloud.

[Connect your SDKs](https://docs.pug.sh/self-hosting/connect-sdks/)

### Use SSO on your servers and on Pug Cloud.

Okta, Entra ID, and Google Workspace sign-in work on both, with no SSO tax.

[How SSO works](https://docs.pug.sh/get-started/sso/)

[Self-hosted product analytics](https://pug.sh/self-hosted-analytics)

## Priced by events alone. Every feature is on every plan, including the free one.

### Pug Cloud

$0 up to 100k events a month

Past that, $1 a month plus usage, at per-event rates that fall as you grow.

[Start free](https://app.pug.sh)

- 5 years of history (1 year while free)
- SSO with Okta, Entra ID, or Google Workspace
- No per-seat or per-project fees
- No credit card to start
- Email support

### Self-hosted.

Free forever under AGPL-3.0. The whole stack runs on your servers, with no event limit beyond your hardware and support on GitHub and Discord.

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

### Custom.

For very high volume, longer history, or an annual contract, we set up a plan with its own rates and allowance.

[Email hello@pug.sh](mailto:hello@pug.sh)

- [Pricing FAQ](https://pug.sh/pricing)
- [Compare the cost with other tools](https://pug.sh/tools/analytics-cost-calculator)
