Webclat / PostHog Practice

PostHog feature flags: rollout design that does not become technical debt

A feature flag is easy to create and easy to forget. The engineering problem is not turning a flag on - it is designing the rollout, the targeting, and the cleanup so the flag does not outlive its purpose.

What a feature flag actually is doing

A feature flag is a runtime decision point: a request comes in, the flag evaluates against rollout percentage, targeting rules, or both, and the code branches. That evaluation happens on every relevant page load or event, which is why flag volume shows up directly in PostHog's usage-based pricing.

Rollout design, not just rollout percentage

  • Start narrow, widen deliberately. A percentage rollout should map to actual risk tolerance and blast radius, not a round number picked because it looked reasonable.
  • Targeting beats blanket percentage for risky changes. Rolling a change out to internal accounts first, then a defined beta cohort, catches more before it reaches everyone.
  • Multivariate flags need a clear success metric before launch. A flag with three variants and no defined comparison metric is an experiment without a hypothesis.

Flag hygiene: the discipline that prevents debt

PracticeWhy it matters
Naming conventionA consistent flag name pattern makes stale flags findable months later
Owner on every flagSomeone has to be responsible for deciding when a flag is done
Removal as part of "done"A rollout is not complete until the flag and its dead branch are removed
Periodic flag auditCatches flags nobody remembers creating, still evaluating on every load

Where this connects to migration and self-hosting

Teams migrating onto PostHog from another flagging tool (LaunchDarkly, Split, or a homegrown system) need flag-by-flag mapping, not a blanket re-create - see the migration hub. Self-hosted deployments also need flag evaluation volume factored into infrastructure sizing; see the self-hosted guide.

Frequently Asked Questions

What can PostHog feature flags target?

PostHog flags support percentage-based rollouts, targeting by user or group property, and multivariate flags for testing more than two variants at once.

How do feature flags relate to experiments?

PostHog's experimentation product is built on top of its feature-flag system - a flag defines the variants, and the experiment layer adds statistical analysis on top.

What's the biggest flag-hygiene mistake?

Leaving a flag live after the rollout is complete. Every flag is a branch in the codebase; a flag left at 100% forever is dead code wearing a live wire.

Do you help audit an existing flag set?

Yes - a flag audit (which flags are still evaluated, which are stale, which overlap) is a common first engagement, especially before a migration or a self-hosting move.

Get your flag rollout designed, not improvised.

We scope targeting, rollout percentage, and cleanup discipline before the flag ships - or audit the ones already live.

Design My Rollout