The open-source, self-hostable PostHog alternative
PostHog bundles analytics with replay, flags, experiments and surveys, and treats its self-hosted deploy as unsupported. Pug is product analytics with unified profiles that you can self-host with every feature, or run on Pug Cloud. Here is how the two compare, including where PostHog is the better pick.
- You want every feature, SSO included, on your own servers
- You want your own identity provider without buying a platform package
- You want person profiles in the event price, not an add-on
- You want product analytics with unified profiles, not a suite
- You need session replay, feature flags, or experiments
- You want surveys and a SQL data warehouse in one place
- You want a free tier of 1M analytics events a month
- You need SDKs for React Native, Python, PHP, or Java
Pug vs PostHog, feature by feature
Each row sets what ships in Pug today against what PostHog documents. A dash in Pug’s column is a feature Pug doesn’t have.
| Capability | Pug this page | PostHog |
|---|---|---|
| Ownership & operations | ||
| License | AGPL-3.0 | MIT, outside its ee/ directory |
| Self-host price | Free, no plans or limits | Free Docker Compose deploy |
| Self-hosting | ||
| Self-hosting officially supported | Yes | No |
| Vendor’s stance on self-hosting | Documented for production | Officially unsupported, no customer support |
| Paid features on a self-hosted install | Every feature, SSO included | Cloud-only |
| New Kubernetes deployments | Yes | No longer supported |
| Suggested host | A small node, with pug start | 4 vCPU, 16GB RAM, 30GB+ storage |
| Pricing (checked November 2026) | ||
| Free tier | 100k events a month, 1 year of history | 1M analytics events a month, 1 year of history |
| Events past the free tier | Never blocked or dropped | Dropped on the free plan |
| Past the free tier | $1 a month + $0.00002 per event, falling with volume | $0.00005 per event from 1M to 2M, falling with volume |
| Person profiles | Included | Identified events add-on past 1M |
| History on paid usage | 5 years | 2 years |
| Projects | No extra cost | 1 free, 6 on pay-as-you-go |
| Single sign-on | ||
| Google sign-in | Yes | On PostHog Cloud |
| Your own identity provider | Every plan, over OIDC | Scale package ($750/mo) and up |
| Enforce SSO for your domain | Every plan | Boost package ($250/mo) and up |
| SAML | Not in Pug | Scale package and up |
| SCIM provisioning | Not in Pug | Enterprise package |
| SSO on a free self-hosted install | Yes | No |
| AI assistants | ||
| Hosted MCP server | Yes | Yes |
| What an agent can change | Creates and edits dashboards | Reads and writes across its products |
| Listed in Claude’s connectors directory | Yes | Yes |
| Bots & AI crawlers | ||
| Crawlers that never run JavaScript | Reported from your server by @pug-sh/crawlers | Server logs sent as $http_log events |
| Bot report | AI and search crawlers section in the Overview | Bots tab, in alpha |
| Product analytics | ||
| Autocapture | Yes | Yes |
| Trends, funnels, retention | Yes | Yes |
| Unified person profiles | Yes | Yes |
| User-flow Sankey & Top K | Yes | Yes |
| Beyond analytics | ||
| Session replay | Not in Pug | Yes |
| Feature flags | Not in Pug | Yes |
| A/B experiments | Not in Pug | Yes |
| Surveys | Not in Pug | Yes |
| SQL / data warehouse | Not in Pug | Yes |
| SDKs | ||
| SDKs | Web, Android, iOS, Flutter, Node, Go, Ruby | Web, iOS, Android, React Native, Flutter, Python, Go, Ruby, PHP, Java, .NET, Rust and more |
Checked November 21, 2026 by Praveen Kumar, who builds Pug. Sources: PostHog pricing, self-hosting docs, self-hosting disclaimer, hobby Compose file, repository license, posthog-foss mirror, SSO, SAML, OIDC, SCIM, MCP server, MCP FAQ, Claude connector, bot traffic, SDK list, posthog-js usage. Prices change, so confirm them on PostHog’s site before you decide.
Self-hosting PostHog and Pug. PostHog’s hobby deploy starts 47 services on one machine.
PostHog
PostHog’s self-hosted option is its hobby deploy, a free Docker Compose stack under MIT that the deploy-hobby script installs and upgrade-hobby updates. Its Compose file starts PostgreSQL, ClickHouse, ZooKeeper, Redpanda in place of Kafka, Redis, Valkey, SeaweedFS for object storage, Temporal and etcd, beside PostHog’s own capture, ingestion and worker services. PostHog asks for the equivalent of a 4 vCPU, 16GB RAM VM with more than 30GB of storage.
PostHog’s disclaimer says that machine is unlikely to scale past a couple hundred thousand events without significant effort, and new Kubernetes deployments are no longer supported. Self-hosted instances get no customer support and no help recovering lost data. PostHog doesn’t publish CVEs, and its docs say to stay on the latest image and to back up all your data before each upgrade. Every paid-plan feature stays on PostHog Cloud.
Pug
A self-hosted Pug is two deployables on four stores. The pug Go binary is the API server, every worker, the migrations and the CLI, and the dashboard is static files you build with Bun and serve from any web server or CDN. The stores are PostgreSQL 15+, ClickHouse, NATS JetStream, and Dragonfly or any Redis 7+, kept off disk.
On one small box, pug start runs the server and every worker in one process, and a scheduler runs the four pug cron jobs beside it. In production each role runs on its own, from the release binaries or the image each release publishes per role for amd64 and arm64. The docs size a small production deploy at up to about 1,000 events a second, and you add events workers to go past it. Your SDKs change one option, endpoint.
Each upgrade runs pug migrate again, which is safe on an up-to-date store, and security fixes land on main and in the latest release, with no long-term support branches yet. Geo comes from Cloudflare’s headers, so it needs Cloudflare or a proxy that sets them in front of the server, and a self-managed replicated ClickHouse cluster isn’t supported yet.
PostHog’s side is from its self-hosting docs, disclaimer and hobby Compose file, read November 22, 2026.
What each bill comes to. Pug Cloud costs less from about 1.6M to 2.3B events a month.
PostHog bills person profiles as identified events, on top of its analytics rate: from 1M to 2M events a month, an identified event costs $0.000248 against $0.00005 for an anonymous one. From 5M to 100M events, PostHog’s bill is 1.8 to 2.2 times Pug Cloud’s with no event identified, and 4.4 to 6.5 times with every event identified, so it grows with the share of your events that come from signed-in users. Pug Cloud’s bill is its monthly fee and per-event rates, and profiles, seats, projects and SSO cost nothing extra.
| Events a month | Pug Cloudprofiles included | PostHog Cloudno event identified | PostHog Cloudevery event identified |
|---|---|---|---|
| 1M | $19 | $0 | $0 |
| 5M | $87 | $153 | $560 |
| 10M | $167 | $324 | $1,080 |
| 50M | $687 | $1,528 | $3,893 |
| 100M | $1,287 | $2,618 | $5,713 |
Totals for one month at list prices. PostHog’s analytics rates and its Identified events add-on are from its pricing page, read November 22, 2026.
Under 1.6M, PostHog’s free first 1M events keep its bill below Pug’s, and with every event identified Pug Cloud costs less from about 1.1M. Past 250M, PostHog’s analytics rate falls to $0.000009 per event, under Pug’s last tier of $0.00001, which is how its anonymous bill catches up.
Why look for a PostHog alternative
SSO without a platform package
Google, GitHub and GitLab sign-in come with PostHog Cloud, but SAML and OIDC need its Scale package at $750 a month, enforcing SSO needs Boost at $250 a month, and SCIM needs Enterprise. Pug includes Google Workspace and OIDC sign-in, verified domains and Require SSO on every plan, self-hosted included, and has no SAML or SCIM.
How SSO works in PugAn MCP server with one write
PostHog’s hosted MCP server reads and writes across its products, and an x-posthog-read-only header limits a session to read-only tools. Pug’s server has 17 tools: 16 read, and upsert_dashboard creates or edits a dashboard. No connection can delete or share a dashboard, erase a person, or send events. Pug is in Claude’s connectors directory, as PostHog is, and among ChatGPT’s plugins.
The Pug MCP serverWhere PostHog is still the better choice
PostHog has each of these and Pug doesn’t. If your team needs one, PostHog is the better fit.
- Session replay of real user sessions
- Feature flags and gradual rollouts
- A/B experiments
- Surveys
- A SQL-queryable data warehouse
- Error tracking, data destinations and AI observability
- SAML sign-in and SCIM provisioning
- A free tier of 1M analytics events a month
- SDKs for React Native, Python, PHP, Java, .NET and Rust
Moving from PostHog to Pug
posthog-js and Pug’s Web SDK share the same three core calls, so most of the work is moving person properties out of event payloads.
| PostHog | Pug | What changes |
|---|---|---|
posthog.capture('user_signed_up', { plan }) | track('user_signed_up', { plan }) | Same name and properties. Pug event names take letters, digits, _, . and -, so snake_case names carry over unchanged. |
posthog.identify(id, { email }) | await identify(id, { email }) | Merges the anonymous history into the person. In the default cookieless mode it does nothing until the visitor consents. |
posthog.capture('x', { $set: { name } }) | await identify(id, { name }) | Pug reserves property keys that start with $ for its own auto-properties, so $set traits move to identify(). |
posthog.register({ icecream_pref }) | beforeSend: (e) => { e.customProperties.icecream_pref = v } | Pug has no super properties. A beforeSend hook in init() adds the key to every event (npm and loader installs, not the one-tag install). |
posthog.group('company', companyId) | No equivalent | Pug has no group analytics. Put the company on the person as a trait, and filter any insight by it. |
posthog.reset() | reset() | Clears the stored identity and starts a new anonymous id and session, sending queued events first. |
- posthog-js autocaptures $pageview and its own click events. Pug’s Web SDK sends page_view, click, scroll, form_start, form_submit, rage_click and dead_click, so rebuild each insight on Pug’s names.
- Keep posthog-js loaded if you use feature flags, session replay or surveys: Pug replaces the analytics calls, not those products.
- Server code moves to Pug’s Node, Go or Ruby SDK, where every track call takes the distinct id first, as in the Node SDK’s pug.track(userId, kind, props).
Pug has no importer for PostHog’s history, so it counts from the day its SDK goes in: run both until the reports you rely on are rebuilt in Pug. To bring an export across, the Node SDK’s track() takes a timestamp option.
What ships in Pug today
Pug ships autocapture on the web, seven insight types (trends, funnels, retention cohorts, segmentation, user flows, Top-K and a map), unified profiles, dashboards and a Live view, in the AGPL-3.0 server and on Pug Cloud alike.
Is PostHog open source?
Yes, apart from its ee/ directory. PostHog’s main repository is MIT-licensed except for that directory, which has its own license, and PostHog also publishes posthog-foss, a read-only mirror with all proprietary code removed (checked November 21, 2026).
Is Pug open source?
Yes. Pug’s server and dashboard are AGPL-3.0 and its SDKs are MIT, with no proprietary directory and no paid edition: every feature, SSO included, is in that code. Next to PostHog the difference is copyleft against permissive, not open against closed.
Is Pug a full replacement for PostHog?
No. Pug is focused product analytics with unified profiles. It does not have session replay, feature flags, experiments, or surveys. If you need those in one platform, PostHog is the better fit.
Does my data stay on my servers?
When you self-host Pug, yes: every event stays in your own ClickHouse and PostgreSQL, and the MCP server a self-hosted install serves at its own /mcp reads from them. Pug Cloud’s MCP endpoint is https://api.pug.sh/mcp.
Other Pug comparisons
Send your first event.
Create a project, add the snippet, and watch the Live view fill up. Or open the demo first: the real dashboard on a sample pet shop, with no sign-up.
Questions? Email hello@pug.sh