Tags: analytics experimentation platform
PostHog
Checked: 2026-10-29
Product analytics, session replay, feature flags, experiments, surveys and a warehouse, all reading and writing one event store keyed to one person model. The bundle is the product: an experiment result, the replays behind it and the funnel it moved are three views of the same rows.
§0 The one idea
One event table, one identity, every product a view over it.
Every SDK (software development kit — the client library) call — a pageview, a flag check, a replay snapshot, a survey answer — becomes an event with a distinct_id, lands in ClickHouse (a column-store database built for scanning billions of rows), and resolves to the same person. Flags read person properties to decide who gets what; the flag check itself is logged as an event; the experiment is a query over those events. Nothing is exported between tools because there is only one tool.
vs a typical stack: GA4 for analytics, Hotjar for replay, LaunchDarkly for flags, Optimizely for tests. Four identity systems, four cookies, four definitions of “user”, glued by passing IDs between them — and every result needs a join that nobody owns.
TYPICAL STACK POSTHOG
GA4 ───── client_id posthog-js / server SDK
Hotjar ── its own user id │ distinct_id
LaunchDarkly ── context key ▼
Optimizely ── visitor id ONE EVENT STORE (ClickHouse)
│ │ person_id
▼ ▼
"which replays were in variant B, analytics · replay · flags
and did they convert?" experiments · surveys · SQL
= four exports and a join = one filter
What you give up: depth in any single product. PostHog’s experiment engine, replay and web analytics are each less mature than the best specialist — the case for it is that they share data, not that each is best in class.
At a glance
| Storage | ClickHouse for events; PostgreSQL holds the current person record |
| Unit of data | The event, with a distinct_id and free-form properties |
| Identity | distinct_ids resolve to a person; identify links anonymous → known |
| Person profiles | Created only for identified users by default (identified_only) |
| Anonymous vs identified events | Billed differently; anonymous can’t use person properties |
| Query language | SQL — a wrapper over ClickHouse SQL, called HogQL internally |
| Flags | Boolean, multivariate, remote config. Local or remote evaluation |
| An experiment is | Multivariate flag + $feature_flag_called exposure + metrics |
| Stats engines | Bayesian (default) and frequentist (Welch’s t-test, optional sequential) |
| Built-in checks | Sample ratio mismatch (SRM) test, minimum-sample gates |
| Regions | US or EU (Frankfurt). Separate instances, chosen at signup |
| Self-hosting | Docker Compose “hobby” deploy, MIT licence, officially unsupported |
| Ad blockers | Block it by default — use the reverse proxy |
| Billing | Per product, usage-based, with a free allowance on each |
The data model
Organisation billing, members
└─ Project one data silo, one project token
├─ events immutable once written
│ distinct_id · event · timestamp · properties{}
│ person_id · person_properties{} (copied at ingestion)
│ $session_id · $group_0..4
├─ persons current properties, mutable
│ └─< distinct_ids many IDs → one person
├─ groups (≤5 types) company, workspace…
├─ session recordings blob storage, keyed by $session_id
├─ flags · experiments · cohorts · surveys · insights
└─ warehouse tables Stripe, Postgres, S3…
Project is the silo. Every query is project-scoped, and each project has its own write-only token. PostHog’s recommendation is separate projects for local, staging and production so test traffic never touches live numbers. Usage across projects pools into one bill. [CHECK: “environments” existed as a sub-project concept in 2024–25; current docs describe projects only — confirm whether environments survive and how they relate]
Events and properties
The generic Events and Properties model, with PostHog’s reserved names prefixed $:
{
"event": "$pageview",
"distinct_id": "0192f3a1-anon-uuid",
"timestamp": "2026-10-29T10:00:00Z",
"properties": {
"$current_url": "https://shop.example/products/cleanser",
"$session_id": "0192f3a1-…",
"$browser": "Chrome",
"$feature/new-pdp": "test",
"plan": "free"
}
}- Events are immutable once in ClickHouse. No editing, no backfilling a property onto old rows. A wrong property name stays wrong in history — which is why Event Taxonomy Design matters more here than in a tool that lets you rename in the UI
$-prefixed = PostHog’s.$pageview,$autocapture,$identify,$feature_flag_called,$feature/<key>. Your own events and properties are unprefixed- Person properties are stamped onto each event at ingestion (persons-on-events). Querying “plan at the time of the event” is fast; querying “plan now” needs a join to
personsor a cohort. [CHECK: projects created before June 2024 can switch the default mode in settings — confirm current mode names]
Persons and distinct IDs
A person is not an ID. It’s a record that one or more distinct_ids point at. Every event carries a distinct_id; the person is resolved from it.
distinct_ids person
──────────── ──────
0192f3a1-anon-uuid ─┐
user_8812 ─┼──────→ P-7 {email, plan: "pro", country: "GB"}
0192f9c4-phone-uuid ─┘
Person profiles are optional per event. With person_profiles: 'identified_only' (the web default), events before identify are anonymous: recorded, queryable, but no person record is created. The distinction matters because the products split on it:
| Anonymous event | Identified event | |
|---|---|---|
| Trends, funnels, SQL on event properties | Yes | Yes |
| Person properties, cohorts | No | Yes |
| Target flags / experiments / surveys on person properties | No | Yes |
| Lifecycle insights, group analytics | No | Yes |
| Billing | ”events” line | ”person profiles” line, up to ~4× dearer per event |
The other values: 'always' (every event creates or updates a person) and 'never' (mobile SDKs; nothing does). Server-side, set $process_person_profile: false on a capture to keep it anonymous.
setPersonPropertiesForFlags() lets a flag target on a property for this evaluation without creating a profile — the escape hatch when you want targeting on anonymous traffic.
Groups
Optional second axis of identity — company, workspace, team — for B2B (business-to-business) products.
posthog.group('company', 'acme_ltd') // later events carry $group_0 = acme_ltd- Up to 5 group types per project
- A paid add-on, billed on identified events once enabled, not on group calls
- Flags can bucket by group rather than person — every user at Acme gets the same variant. This is how you set the Randomisation Unit to the account in an experiment
Sessions
$session_id is set by the client SDK, not computed afterwards — Sessionisation happens in the browser. Replay, web analytics and session-level metrics all key off it. [CHECK: inactivity timeout and maximum session length defaults]
Identity
The generic problem is Identity Stitching and Anonymous and Identified Users; this is PostHog’s specific mechanism.
identify
// after login — stable ID from your auth system, never an email
posthog.identify('user_8812', {
email: 'max@example.com', // person property ($set)
plan: 'pro',
})
// on logout
posthog.reset() // new anonymous distinct_id; device no longer linkedWhat happens:
BEFORE identify AFTER identify('user_8812')
distinct_id event person distinct_id event person
0192f3a1-anon $pageview – 0192f3a1-anon $pageview P-7 ← linked
0192f3a1-anon add_to_cart – 0192f3a1-anon add_to_cart P-7 ← linked
user_8812 $identify P-7
user_8812 purchase P-7
persons: none persons: P-7 ← user_8812, 0192f3a1-anon
The anonymous ID is now an alias of P-7, so a funnel from $pageview to purchase completes for one person instead of breaking across two. The events themselves aren’t rewritten — they’re immutable — the link is in the distinct_id → person mapping. [CHECK: exact override mechanism by which already-written events’ person_id is reconciled at query time]
alias and merging
alias(newId, existingId)links two distinct IDs to one person — for joining a backend ID to a frontend one when neither is anonymous. The alias ID mustn’t already be used in anidentifyoralias$merge_dangerouslyforces two persons together. Irreversible, no safeguards- PostHog refuses to merge two already-identified persons. Logs an ingestion warning (“Refused to merge an already identified user”) and moves on. Protects against a bug merging the whole user base; also means a user who logs in as two accounts on one device stays split
The pitfalls
- Illegal IDs are rejected, silently-ish.
null,undefined,[object Object],0,anonymous,guest,id,email,true,false,NaN, empty strings and a few others: the event is kept, the merge is refused, a warning lands in the ingestion warnings page. A templating bug sendingidentify('null')would otherwise merge every visitor into one person - Not calling
reset()on logout — the next person on a shared machine inherits the identity. Call it even if you think nobody shares machines - Identifying by email — breaks when the email changes. Use the database ID, send email as a property
- Identify on every device — skip it on mobile and that device is a separate person forever
- Identify only once per session — repeated identical calls without a reload are ignored, so you can’t rely on re-identifying to refresh properties
Ingestion
SDK (browser / server / mobile)
│ batched HTTPS POST → us.i.posthog.com | eu.i.posthog.com
│ (or your reverse proxy)
▼
CAPTURE (Rust) ─── replay snapshots ──→ Kafka → blob storage (S3)
│ validates, writes raw event
▼
KAFKA
▼
INGESTION
│ person processing: distinct_id → person, $set / $set_once applied
│ person properties stamped onto event
│ TRANSFORMATIONS (Hog functions): GeoIP, drop, redact…
▼
CLICKHOUSE events ──→ insights · SQL · experiments
│
└──→ DESTINATIONS: realtime (webhooks, CRMs) · batch exports (warehouse)
Flag requests go to a separate flags service, reading PostgreSQL / cache.
[CHECK: the current architecture page names capture, Kafka, a Node “CDP” service and ClickHouse but doesn’t name the person-processing stage — the position of transformations relative to person processing above is inferred]
Consequences:
- Person properties are set in ingestion order, not event timestamp order. Late or historical imports can overwrite a newer value with an older one
- Ingestion is near-real-time, not instant. A just-fired event may not show in a query for a short while [CHECK: typical lag]
- Transformations run before storage, so they’re the place to strip personal data — once written, it’s immutable. See PII in Analytics
- Data pipelines is the current name for the CDP-like surface (Customer Data Platform: collect once, route to many tools — see Customer Data Platforms): sources in, transformations in flight, destinations out. Transformations and realtime destinations are written as Hog functions — Hog being PostHog’s own small scripting language — from a template or by hand
Collection
The client SDK
The smallest working form. This is complete — pageviews, autocapture and session IDs all start from this:
import posthog from 'posthog-js'
posthog.init('<ph_project_token>', {
api_host: 'https://eu.i.posthog.com', // EU region ingestion
defaults: '2026-08-30', // config snapshot — see below
})defaults is a date, not a version. It pins a snapshot of default settings so behaviour doesn’t change under you when the SDK updates. Each snapshot date bundles changes — 2025-05-24 switched capture_pageview to 'history_change' (pageviews on single-page app route changes); later ones adjusted replay and rage-click defaults. Any option you set explicitly overrides the snapshot. Bumping the date is a deliberate upgrade.
Add a custom event:
posthog.capture('checkout_started', {
basket_value: 54.97, // pounds, not pence — decide once
item_count: 3,
})Add consent handling — PECR (the Privacy and Electronic Communications Regulations, which govern cookies in the UK) means no non-essential storage before consent:
posthog.init('<ph_project_token>', {
api_host: 'https://eu.i.posthog.com',
defaults: '2026-08-30',
cookieless_mode: 'on_reject', // or 'always' — no cookies, no storage
})
// cookie banner handler
posthog.opt_in_capturing() // or opt_out_capturing()- Default persistence is
localStorage+cookie— a cookie namedph_<token>_posthog, 365 days cookieless_mode—'always'sets no cookies and uses no storage from the start;'on_reject'switches to that only when the user declines. Must also be enabled in project settings, or cookieless events are dropped. [CHECK: how cookieless identity is derived server-side and what it costs in returning-user accuracy]opt_out_capturing_by_default: true— nothing until opted in- The legal question is UK GDPR and PECR for Analytics and Consent Management; this is only the switches
Autocapture vs custom events
Autocapture is on by default in the web SDK.
What it collects without code:
- Clicks on
a,button,form,input,select,textarea,label; form submissions;contenteditablechanges; copy events $pageviewand$pageleave$rageclick— three clicks within 30px and 1 second- Dead clicks — a click not followed by any page change
- Heatmap data (clicks, mouse movement, scroll) — no extra events created
- Web vitals: largest contentful paint (LCP), cumulative layout shift (CLS), first contentful paint (FCP), first input delay (FID) [CHECK: whether INP has replaced FID in the captured set]
What it never collects: form field values on submit, password-field contents on copy.
Actions turn autocapture into named events after the fact — “clicked button with text ‘Add to basket’ on /products/*” becomes Add to basket. Because autocapture recorded the raw clicks, an action applies to history, not just from the day it’s defined. That’s the genuine advantage over a tag-manager setup.
The quirk: autocapture describes clicks by element and text. Change the button copy from “Add to basket” to “Add to bag” and the action silently stops matching. Pin actions to stable attributes:
<button data-ph-capture-attribute-cta="add-to-basket">Add to bag</button>
<div class="ph-no-autocapture">…</div> <!-- excluded -->Rule of thumb: autocapture for exploration and “did anyone click this”; custom capture() for anything that’s a metric, an experiment goal or a funnel step. Metrics shouldn’t depend on button copy.
Server-side
The smallest working form in Node:
import { PostHog } from 'posthog-node'
const client = new PostHog('<ph_project_token>', { host: 'https://eu.i.posthog.com' })
client.capture({ distinctId: 'user_8812', event: 'order_completed',
properties: { revenue: 54.97, currency: 'GBP' } })
await client.shutdown() // flush before exit; use flush() if the client is reusedServer-side events have no anonymous session to merge — you supply the distinct_id. Send revenue from here, not the browser — see Client-Side vs Server-Side Tracking.
Ad blockers and the reverse proxy
PostHog is on most blocklists. *.i.posthog.com requests fail silently for a meaningful share of a technical audience — see Ad Blockers and Tracking Loss.
blocked: browser → eu.i.posthog.com ✗
proxied: browser → shop.example/ingest → eu.i.posthog.com ✓
- Managed reverse proxy — PostHog hosts it on your subdomain, free on Cloud
- Self-run — Cloudflare, Next.js rewrites, Vercel, nginx, CloudFront and others; documented per platform
- Set both hosts:
api_hostto the proxy,ui_hostto PostHog’s real domain (https://eu.posthog.com), or toolbar and links break - The assets host is separate —
eu-assets.i.posthog.comserves the replay and surveys scripts and needs proxying too
Flags are hit hardest: a blocked /flags request means the user gets no variant, which is an experiment exposure that never happens — a quiet source of Sample Ratio Mismatch if blocking correlates with the variant.
Feature flags
Generic concept: Feature Flags. PostHog’s choices:
Three types:
- Boolean —
trueif a release condition matches,falseif disabled,undefinedif no condition matched - Multivariate — returns a variant key (
control,test,test-2). The type experiments use - Remote config — a static payload delivered at runtime, no targeting
Release conditions are condition sets — property filters plus a rollout percentage. A user matches when all filters pass and they fall inside the percentage. Any matching set passes. Payloads attach JSON per variant, so the variant can carry its config rather than just a name.
Bucketing
Deterministic hashing — no stored assignment. From the SDK source:
// hash = SHA-1 of "<flag_key>.<distinct_id>", first 15 hex chars, scaled to 0–1
const h = parseInt(sha1(`${flagKey}.${distinctId}`).slice(0, 15), 16) / 0xFFFFFFFFFFFFFFF
const inRollout = h < rolloutPercentage / 100
// variant uses a second hash, salted, so rollout and variant are independent
const v = parseInt(sha1(`${flagKey}.${distinctId}variant`).slice(0, 15), 16) / 0xFFFFFFFFFFFFFFF
// v in [0, 0.5) → control, [0.5, 1) → test (for a 50/50 split)What follows, and the generic version is Assignment and Bucketing:
- Same distinct_id + same flag key = same answer, on any server, forever. No database lookup
- The flag key is the salt. Renaming a flag reshuffles everyone. Two flags with different keys are independent
- The bucketing value is the
distinct_id— so an anonymous visitor who logs in gets a newdistinct_idand may switch variant. Fixes: experience continuity (“persist flag across authentication steps” — stores the pre-login value; off by default, needs person profiles, incompatible with local evaluation and bootstrapping, slows responses) or bucketing ondevice_id, which recent SDKs support [CHECK: UI name and availability of device_id bucketing]. Or bucket by group - Rollout precision to 0.01%
Remote vs local evaluation
REMOTE (default — every client SDK)
app ──── distinct_id + props ───→ /flags ───→ PostHog evaluates ──→ variants
one network round trip per evaluation · billed per request
LOCAL (server SDKs only)
app ── every 30s ──→ fetch flag definitions (secret key) ← billed per poll
│
└── user request → evaluate in-process against definitions → variant
no network call · needs the properties passed in
can't evaluate → falls back to remote (unless onlyEvaluateLocally)
Local evaluation can’t handle: experience continuity, static cohorts, is_not_set operators, early-access-feature flags, early-exit condition sets in most SDKs, some multi-cohort setups. And it only knows the properties you pass — it can’t look up the person in PostgreSQL.
Local billing: polls only — 10 flag requests when definitions changed, 1 when unchanged (usually a 304).
Local needs a secret key (project secret API key, or a personal API key). Never ship it to the browser.
Server-side, the current API is a snapshot:
const client = new PostHog('<ph_project_token>', {
host: 'https://eu.i.posthog.com',
secretKey: process.env.POSTHOG_SECRET_KEY, // enables local evaluation
})
const flags = await client.evaluateFlags('user_8812', {
personProperties: { country: 'GB' }, // local eval only sees what you pass
})
if (flags.getFlag('new-pdp') === 'test') { /* … */ } // sends $feature_flag_called
client.capture({ distinctId: 'user_8812', event: 'order_completed', flags })
// ↑ attaches $feature/new-pdp: 'test' without another /flags callevaluateFlags() replaces the older getFeatureFlag() / isFeatureEnabled() / capture({ sendFeatureFlags: true }), which still work but are deprecated. Evaluate once per request, read many times.
Evaluation runtime per flag: both (default), client only, server only. Evaluation contexts restrict a flag to SDKs sending a matching context — formerly “evaluation environments”.
Flicker and bootstrapping
Client-side, flags arrive after init via a /flags request. Until then getFeatureFlag() returns undefined — the control renders, then swaps. That’s Flicker and Flash of Original Content.
Bootstrapping fixes it by evaluating on the server and handing the result to the client at init:
// server (per request) — same distinct_id the client will use
const distinctId = req.cookies.ph_id ?? crypto.randomUUID()
const flags = await client.evaluateFlags(distinctId)
// → render page with { distinctId, flags: <all values> } inlined
// client
posthog.init('<ph_project_token>', {
api_host: 'https://eu.i.posthog.com',
defaults: '2026-08-30',
bootstrap: {
distinctID: distinctId,
isIdentifiedID: false,
featureFlags: { 'new-pdp': 'test' }, // usable synchronously, before /flags returns
},
})- Bootstrapped values are a seed, not an override. The next
/flagsresponse replaces them; keys only in the bootstrap are dropped - The distinct ID must match on server and client, or the server’s hash and the client’s disagree and the user flips variant on the next refresh
- Incompatible with experience continuity
- This is the Client-Side vs Server-Side Testing tradeoff in PostHog’s terms: bootstrapping needs a server that renders per request, which rules it out for fully static, CDN-cached pages without an edge layer
[CHECK: exact name of the server method that returns all flag values for bootstrapping under the evaluateFlags API — the bootstrapping doc still says getAllFlags()]
Experiments
The strongest reason to pick PostHog for testing is that the experiment is just a flag plus a query. No separate assignment service, no separate event pipeline, so assignment, exposure and outcome can’t disagree about who the user is.
EXPERIMENT = multivariate flag who gets what (hashing above)
+ exposure event who actually saw it
+ metrics queries over events after exposure
+ stats engine Bayesian or frequentist
Exposure
A user is exposed when PostHog receives $feature_flag_called with $feature_flag = the experiment’s flag key and $feature_flag_response = a variant. Only exposed users enter the analysis, and only events after their exposure count. This is Experiment Assignment Tracking built in.
What fires it:
- Client:
getFeatureFlag()(oruseFeatureFlagVariantKey()in React) — notgetAllFlags(),getFeatureFlags()or payload-only accessors - Server:
flags.getFlag()/flags.isEnabled()on anevaluateFlags()snapshot — notgetFlagPayload() - Deduplicated per
(distinct_id, flag, value)in the SDK’s cache; reinitialising the client resets the cache
The trap that makes this matter: checking the flag where the variant is decided rather than where it’s seen. Call getFeatureFlag('new-checkout') in a global header and every visitor is “exposed” — including the 95% who never reach checkout. The effect gets diluted by everyone who couldn’t have been affected. Call it at the point of render.
What the data looks like:
events, user u1 (variant: test)
event $feature_flag $feature_flag_response $feature/new-pdp timestamp
$pageview – – – 10:00 ← before exposure: ignored
$feature_flag_called new-pdp test – 10:01 ← exposure
add_to_cart – – test 10:03 ← counts
purchase – – test 10:09 ← counts
$feature_flag_called new-pdp test – 10:15 ← duplicate: one exposure per user per variant
Users in both variants — from a variant flip at login, or a bug — are handled by a setting: exclude from analysis (recommended, default [CHECK]) or use first seen variant. Exclusion keeps the comparison clean but removes users non-randomly if one variant is more prone to flipping.
Custom exposure events — pick any event as the exposure, but it must carry $feature/<flag-key> with the variant value, which you set manually.
Metrics
| Type | Per-user value | Example |
|---|---|---|
| Funnel | Converted yes/no, through ordered steps | $pageview → checkout_started → purchase |
| Mean | Sum or count per user, averaged | revenue per user, orders per user |
| Ratio | One aggregate over another | revenue per order — see Ratio Metrics |
| Retention | Returned within a window | analysed as a ratio |
- Primary and secondary metrics — significance on funnels is computed first step to last only
- Shared metrics — reusable definitions across experiments, the start of a metric library [CHECK: current name]
- Winsorisation — optional per metric, clamps to percentile bounds (e.g. 1st–99th) rather than excluding; on ratios, numerator and denominator are capped independently. See Winsorisation and Capping
- CUPED (Controlled-experiment Using Pre-Experiment Data) — optional, uses each user’s pre-exposure behaviour to cut variance. See Variance Reduction
The stats engines
Two, chosen per experiment, with a project default under Experiments → Settings. Bayesian is the default for new experiments. [CHECK: confirm still the default — docs don’t state it outright]
| Bayesian | Frequentist | |
|---|---|---|
| Headline output | Chance to win | p-value |
| Interval | Credible interval | Confidence interval (or confidence sequence) |
| Model | Normal approximation to the posterior, non-informative prior (mean 0, very wide) | Welch’s t-test, two-sided |
| Peeking | Not addressed by PostHog’s docs | Sequential testing option makes it safe |
| Significant when | Chance to win > confidence level (or < 1 − level) | p < α |
| Confidence level | 90 / 95 / 99%, default 95% | same |
Background: Bayesian vs Frequentist, Credible Intervals, Confidence Intervals, P-Values.
Welch’s t-test — the two-sample t-test that doesn’t assume both variants have the same variance. Non-informative prior — a starting belief so vague it has no effect, so the result is driven entirely by the data.
In plain terms: both engines are doing the same arithmetic on the same numbers — “how big is the difference, and how much would it wobble by chance?” — and then phrasing the answer differently. With a prior this flat, they will almost always agree.
Worked example — the same data through both
A product page test. 50/50 split, funnel metric (exposed → purchase).
exposed purchased rate
control 10,000 300 3.00%
test 10,000 330 3.30%
Step 1 — the difference.
absolute: 3.30% − 3.00% = 0.30 percentage points
relative: 0.30 / 3.00 = +10%
Step 2 — how much each rate wobbles. For a conversion rate, variance = p(1 − p) / n:
control: 0.030 × 0.970 / 10,000 = 0.00000291
test: 0.033 × 0.967 / 10,000 = 0.00000319
sum = 0.00000610
standard error = √0.00000610 = 0.00247 (0.247 pp)
Step 3 — how many standard errors is the difference?
z = 0.00300 / 0.00247 = 1.21
Step 4a — Bayesian. With a flat prior, the posterior for the true difference is Normal(mean 0.30pp, sd 0.247pp). Chance to win is the share of that curve above zero:
chance to win = P(Normal(1.21, 1) > 0) = 0.888 → 89%
95% credible = 0.30 ± 1.96 × 0.247 = −0.18pp to +0.78pp
≈ −6% to +26% relative
89% < 95% threshold → not significant.
Step 4b — frequentist.
two-sided p = 2 × (1 − 0.888) = 0.22
95% confidence interval = −0.18pp to +0.78pp ← identical
0.22 > 0.05 → not significant.
What to notice:
- “89% chance to win” sounds like a win and isn’t. It means an 11% chance test is worse — and the interval says the true effect could be anything from −6% to +26%. Many teams ship at 89%; PostHog’s default threshold won’t call it
- The intervals are numerically identical. With a flat prior, chance to win ≈ 1 − p/2. The engine choice changes the wording on the screen, not the decision. Pick the one your stakeholders will misread least
- Counterintuitive: a +10% relative lift on 20,000 users is not detectable here. At a 3% baseline, detecting a 10% relative lift at 80% power needs roughly 51,000 per variant — this test is at a fifth of that. See Minimum Detectable Effect and Statistical Power. PostHog has a sample-size calculator in the experiment setup; use it before launch, not after
- PostHog’s own internals may compute the posterior on the relative scale rather than absolute [CHECK: scale used for the posterior — the docs show relative difference in the UI]; the conclusion above doesn’t change
Sequential testing
Frequentist only. Replaces the fixed-horizon t-test with confidence sequences (Waudby-Smith et al., 2023) — intervals valid at any stopping point, so checking daily doesn’t inflate false positives. Off by default; enable per experiment or project-wide (“Apply sequential testing by default”). Tuning parameter defaults to 5,000. [CHECK: what the tuning parameter controls — likely the sample size at which the sequence is tightest]
In plain terms: the ordinary test assumes you look once, at the end. Look every day and stop the first time it says “significant”, and you’ll declare far more false winners than 5% — Peeking. Sequential testing widens the interval early to pay for the extra looks. Cost: you need somewhat more data to reach a verdict. See Sequential Testing and Stopping Rules.
The Bayesian docs don’t discuss peeking. A Bayesian chance-to-win read daily with a stop-when-it-crosses-95% rule has the same problem in different clothes.
What it doesn’t correct for
No multiple-comparison correction, for variants or metrics. Each metric × variant is tested independently at your α. PostHog’s own docs give the numbers:
P(at least one false positive) = 1 − 0.95^k
5 metrics: 1 − 0.95^5 = 1 − 0.774 = 0.23 → 23%
10 metrics: 1 − 0.95^10 = 1 − 0.599 = 0.40 → 40%
In plain terms: check ten metrics with no real effect anywhere, and 40% of the time at least one lights up green by chance. Decide the primary metric before launch (Pre-Registration); treat the rest as Guardrail Metrics or diagnostics. See The Multiple Comparisons Problem.
Built-in checks
- Minimum sample gates — no result shown until each variant has ≥ 50 exposures; funnels also need ≥ 5 conversions per variant and both n·p and n·(1 − p) > 5; mean and ratio metrics need a non-zero control mean
- SRM check — chi-squared test of actual vs configured split once there are ≥ 100 exposures; flags at p < 0.001. Yellow warning = stop reading the result and find the bug. See Sample Ratio Mismatch
- Recordings from the result — every variant links to its session replays. The thing a separate replay tool can’t do without an export
Holdouts
A holdout excludes a percentage of users from every experiment it’s attached to — measuring the cumulative effect of everything shipped against a group that got none of it (Holdout Groups).
- Created under Experiments → Holdout groups; 1–10% suggested
- Membership is a hash, not a list: SHA-1 of
holdout-<distinct_id>, deliberately a different separator from flag hashing so holdout and rollout are independent - Held-out users receive the variant
holdout-{id}, checked before any other condition - Assigned to an experiment in draft; locked at launch. Changing the holdout percentage later still changes every attached experiment’s flag
The other products
Product analytics — insights over events: trends, funnels, retention, paths, stickiness, lifecycle. Lifecycle and anything person-based need identified events. See Funnel Analysis, Retention Curves, Path Analysis, Cohort Analysis.
SQL — a dialect wrapping ClickHouse SQL, called HogQL internally, with shortcuts for properties and null handling:
SELECT properties.$current_url AS url, count() AS views
FROM events
WHERE event = '$pageview'
AND timestamp > now() - INTERVAL 7 DAY
GROUP BY url
ORDER BY views DESC
LIMIT 20Warehouse tables are queryable in the same statement as events, persons and sessions. [CHECK: exact syntax for current person properties, e.g. person.properties.plan]
Session replay — DOM recording with console logs and network waterfall, each recording enriched with the person and their active flags. Masking for text, inputs and elements before capture; sampling and URL / flag gating via recording rules. Mobile replay for iOS, Android, React Native, Flutter, billed separately. See Session Replay. [CHECK: inputs masked by default; retention period by plan]
Web analytics — a GA-style dashboard (visitors, sources, pages, bounce) built on the same $pageview events. Not a separate collection. [CHECK: billing — whether web analytics events are product analytics events or a separate line]
Surveys — in-app popovers or API-driven, targeted by flags and person properties, responses stored as events. See Surveys.
Data warehouse — sources (Stripe, Postgres, Salesforce, S3 and others) synced into PostHog and joinable to events and persons in SQL. The Warehouse-First Analytics direction run in reverse: bring the business data to the product data.
Names to recognise: error tracking, LLM analytics, logs, product tours, early access features, PostHog AI.
Hosting
Cloud regions
US Cloud us.posthog.com ingest: us.i.posthog.com
EU Cloud eu.posthog.com ingest: eu.i.posthog.com AWS Frankfurt (eu-central-1)
- Separate instances. Chosen at signup; moving means migrating [CHECK: whether in-place region move is now offered]
- EU is the default choice for UK work. Keeps data in the EU, which the UK treats as adequate. Doesn’t make you compliant on its own — consent and erasure are still yours. See Data Residency
- PostHog’s own guidance: EU Cloud for GDPR (General Data Protection Regulation); US possible with extra safeguards. [CHECK: DPA (data processing agreement) terms and subprocessor list on posthog.com]
Self-hosted
- Hobby deployment — Docker Compose on one Linux VM, roughly 4 vCPU / 16 GB RAM / 30 GB+ disk, installed by a script. MIT licence
- Officially unsupported — no support, no tagged releases or published CVEs (Common Vulnerabilities and Exposures — the public security-advisory IDs); run the latest image
- Free-plan features only — every paid feature is Cloud-only
- Kubernetes — new paid self-hosted deployments no longer supported
- PostHog’s own steer: past ~300k events consider whether self-hosting is wise; past ~1M a month, use Cloud
The open-source pitch is real but narrower than it sounds. The code is open; running it at commercial volume yourself is discouraged by the vendor.
Pricing model
Billed per product on usage, with a monthly free allowance on each — including on paid plans. No figures here; they change.
| Product | Billing axis |
|---|---|
| Product analytics | Events — anonymous and identified priced differently |
| Person profiles | Identified events |
| Session replay | Recordings (one per session); mobile separate |
| Feature flags | /flags requests; local eval billed per poll |
| Experiments | Via feature flag requests — no separate line |
| Surveys | Responses [CHECK] |
| Data warehouse | Rows synced [CHECK] |
| Data pipelines | Realtime destination events triggered; batch export rows |
| Group analytics | Paid add-on, charged on identified events |
What drives the bill in practice:
person_profiles: 'always'— every anonymous event becomes an identified one, up to ~4× dearer- Client-side flag requests — one per page load per user, per
/flagscall. Caching or local evaluation server-side cuts it - Replay with no sampling on a high-traffic site
- Billing limits per product can cap spend; hitting one stops ingestion for that product, which silently truncates data
Quirks and limits
- Events are immutable — fix taxonomy before launch, or live with it in history
- Person properties are last-write-wins in ingestion order — not timestamp order
- Variant flip at login unless you choose experience continuity, device bucketing or group bucketing — and continuity rules out local evaluation and bootstrapping
- Ad blockers take out analytics, replay and flags together — one blocked domain is three products’ worth of data loss. Proxy from day one
- Exposure is wherever you call
getFeatureFlag()— not where the user sees the change - No multiple-comparison correction, no sequential option for Bayesian
- Renaming a flag key reshuffles every user
- Free plan is one project — separate staging needs a paid plan
- Two identified persons won’t merge — by design, and occasionally the cause of a “duplicate user”
- PostHog ships and renames constantly — config is pinned by
defaultsdates, and docs move. Re-check this note against the docs before relying on any specific option name
Borders
- Analytics — Identity Stitching · Anonymous and Identified Users · Autocapture · Event Taxonomy Design · Session Replay · Ad Blockers and Tracking Loss · Consent Management
- Experimentation — Assignment and Bucketing · Experiment Assignment Tracking · Client-Side vs Server-Side Testing · Flicker and Flash of Original Content · Holdout Groups · Rollouts as Experiments
- Statistics — Bayesian vs Frequentist · Sequential Testing · Sample Ratio Mismatch · Variance Reduction
- Web Development — Feature Flags
- Platforms — GA4 · GrowthBook · Statsig · LaunchDarkly · Optimizely · Amplitude