PostHog

Product analytics with session replay, feature flags, and a data warehouse

NOT REALLY · consider alternatives
price variesestimated build time closest consolation build: one sittingreplaced by 0 people

First-party collection and a dashboard that answers your top five questions is one sitting of work, and PostHog's free tier covers a million events a month before you pay anything. What the bill buys past that is the rest of the platform: session replay, feature flags, SQL over years of events, and ingestion that stays correct while your event schema drifts underneath it.

Build verification: not recorded. How we judge buildability

What you give up

  • session replay
  • feature flags and experiments
  • identity stitching across devices
  • SQL over years of events
  • ingestion that stays up without you watching it

Why people still pay

Teams pay because analytics has to keep collecting and stay trustworthy while the product changes underneath it. The bill buys bot filtering, identity resolution, late-arriving data, retention, query cost, and someone else getting paged when ingestion stops. The charts are the cheap part.

Your build guide

The stack, security requirements, and agent rules for a focused replacement.

Before you start

  • Node 22
  • a small always-on VPS
  • a domain you control, for first-party collection
01
One Node 22 + Express process with better-sqlite3, serving the collector and the dashboard on port 8787. No frontend framework, no build step, no Docker.
02
Model data sources, dated observations, derived metrics, and report snapshots; keep stable source IDs and timestamps.
03
Interface for this web and product analytics workflow: a local web page with input, progress, review, and export views.
engineering roadmap

Implementation plan

1

Phase 1, architecture and data

One Node 22 + Express process with better-sqlite3, serving the collector and the dashboard on port 8787. No frontend framework, no build step, no Docker. Model data sources, dated observations, derived metrics, and report snapshots; keep stable source IDs and timestamps.

2

Phase 2, implement

One SQLite events table: site, event, path, referrer, UTM fields, country from the proxy header, device class, and a JSON properties blob.

3

Phase 3, implement

Dashboard at / with a date range picker: visitors and pageviews by day, top pages, referrers, countries, any event split by one property, and a three-step funnel.

4

Phase 4, review and output

Nightly rollup into a daily-summary table, raw events pruned past the retention window in .env, /export.csv for the raw rows.

5

Phase 5, recovery and acceptance

On invalid input or interrupted processing, keep the original record, show the failed step, and permit a safe retry. Verify this invariant with a saved fixture: A replayed batch cannot double-count events; missing or late data must be labelled in the report. State the practical limit: session replay.

the pro prompt
Build me a self-hosted web analytics box to replace PostHog. Requirements:

- One Node 22 + Express process with better-sqlite3, serving the collector and the
  dashboard on port 8787. No frontend framework, no build step, no Docker.
- A tracker.js I paste on my sites: pageviews on load and history change, plus
  window.track('signup', { plan: 'pro' }), POSTed to /e on my own domain so
  collection stays first-party.
- One SQLite events table: site, event, path, referrer, UTM fields, country from the
  proxy header, device class, and a JSON properties blob.
- Count visitors by a daily-rotating salted hash of IP plus user agent, salt in .env.
  No cookie, never the raw IP. That is the whole privacy design, keep it.
- Dashboard at / with a date range picker: visitors and pageviews by day, top pages,
  referrers, countries, any event split by one property, and a three-step funnel.
- Nightly rollup into a daily-summary table, raw events pruned past the retention
  window in .env, /export.csv for the raw rows.
- Basic auth on the dashboard, collector open. No accounts, no telemetry, my box
  holds the only copy.
- Out of scope: session replay, feature flags, and stitching one person across
  devices. Do not build a plugin system or a warehouse connector.
- README: the snippet to paste, where the SQLite file lives, and how to back it up.

$ open in your agent (prompt prefilled, you press enter), copy the prompt or copy AGENTS.md

prior art · use these instead of building, if you'd ratherUmamiPopular open-source privacy-focused web analytics platform.↗
share on X ↗

PostHog pricing

planmonthlyannual (per mo)what you get
free$0/workspace$0/workspace1 project, 1-year retention, unlimited team members; monthly product allowances include 1M analytics events, 5,000 session recordings, 1M feature-flag requests, 100,000 exceptions, 1,500 survey responses, 1M warehouse rows, 10,000 pipeline trigger events plus 1M batch rows, 100,000 AI-observability events, 500 AI credits, 3 PRs, 10,000 workflow messages/channel, 10GB logs, and 2,500 Replay Vision creditsUsage is capped at the free allowances; no card required.
pay-as-you-go$0/workspace—Starts at $0 while under the same monthly free allowances; 6 projects, 7-year retention, unlimited team members and tracked usersUsage above each product's allowance is metered independently; billing limits can be set per product.
boost platform package$250/workspace—Adds platform-level controls and support features to the separately metered PostHog productsThis is an optional platform package on top of product usage charges, not an all-inclusive plan.
scale platform package$750/workspace—Higher platform-level controls and support package; product usage remains separately meteredThis is an optional platform package on top of product usage charges, not an all-inclusive plan.
enterprise platform package——Custom platform controls, support and commercial terms; all product usage remains separately pricedCustom quote.

free tier1 project and 1-year retention; monthly: 1M analytics events, 5,000 session recordings, 1M feature-flag requests, 100,000 exceptions, 1,500 survey responses, 1M warehouse rows, 10,000 pipeline trigger events plus 1M batch rows, 100,000 AI-observability events, 500 AI credits, 3 PRs, 10,000 workflow messages/channel, 10GB logs, and 2,500 Replay Vision credits; unlimited team members

billingmonthly usage-based billing only; no annual plan published; free allowances reset monthly and remain after adding a card

hidden costsEvery product meters separately after its free allowance: analytics from $0.00005/anonymous event or $0.000248/identified event, replay from $0.005/recording, flags from $0.0001/request, surveys from $0.10/response, warehouse rows from $0.000015, pipelines from $0.0005/trigger event, exceptions from $0.00037, AI from $0.01/credit, logs from $0.25/GB, workflows from $0.003/email, Inbox at $15/PR, and Replay Vision at $0.01/credit; optional Boost/Scale packages add $250/$750 per month.

pricing sources checked 2026-08-12 · pricing source ↗

Questions about PostHog

Can you build your own PostHog with AI?

A full replacement is not the recommended project. First-party collection and a dashboard that answers your top five questions is one sitting of work, and PostHog's free tier covers a million events a month before you pay anything. What the bill buys past that is the rest of the platform: session replay, feature flags, SQL over years of events, and ingestion that stays correct while your event schema drifts underneath it.

What does the PostHog build prompt cover?

The prompt starts with this scope: Collect first-party pageviews and custom events from your own sites, keep the raw rows yourself, and answer a handful of product questions from a local dashboard. Full-product capabilities excluded from the comparison include: session replay; feature flags and experiments; identity stitching across devices. Follow the implementation plan and its prerequisites before expanding the build.

How do I use the prompt, AGENTS.md and agent skills?

Start with the PostHog prerequisites and stack, then copy the prompt into your coding agent. Save the project rules as AGENTS.md in the project root. Linked skills are optional packages or source instructions for specific tasks; review their current contents and install only those matching the chosen stack. A skill does not supply API credentials or verify the finished app.

How long will this PostHog project take?

The catalogue estimate is closest consolation build: one sitting for the limited scope. Setup, integration approvals, debugging, deployment and ongoing maintenance can add time. This is an estimate, not a delivery guarantee.

What would I give up by replacing PostHog?

session replay; feature flags and experiments; identity stitching across devices; SQL over years of events; ingestion that stays up without you watching it. Teams pay because analytics has to keep collecting and stay trustworthy while the product changes underneath it. The bill buys bot filtering, identity resolution, late-arriving data, retention, query cost, and someone else getting paged when ingestion stops. The charts are the cheap part.

What can I use instead of building PostHog?

The prior-art section lists Umami as starting points. Review their current scope, license and maintenance before adopting one.

Every week, more subscriptions die.

New verdicts, new prompts, the week's most-doomed apps.
One email. Unsubscribe in one click.

last week:100 Questions · KINDA1of10 · KINDA1Password · KINDA+1090 more

free forever · no scanner spam · the prompt stays on the site, the deaths come to you

$weekly: what got a verdict, what died.