PostHog Page Experiments is an open-source TypeScript package from 99Ways for running PostHog-powered experiments on existing pages. PostHog handles feature-flag assignment and experiment analysis; the package applies the selected variant in the browser.

The package checks page eligibility before it subscribes to or reads a feature flag. Eligibility can be synchronous or asynchronous. If the visitor cannot receive the treatment, the runner returns without reading the flag. For eligible visitors it keeps the original page as an explicit control, applies the configured variant, and supports URL overrides for reviewing variants during QA.

The project grew from the browser-side implementation work that teams need when they want to test a focused change on an existing Shopify, WordPress or other site without rebuilding the whole front end. It has no runtime dependencies and is MIT-licensed. It is an independent community project from 99Ways, not an official PostHog product.

The runner applies a change once. It does not watch later single-page-app mutations or undo DOM changes, and client-side updates can flicker. Those limits matter: teams should confirm that the visitor was eligible, saw the intended variant, generated an assignment exposure, and later triggered the outcome event under the same visitor identity.

For a practical Shopify walkthrough, see 99Ways’ guide to setting up a PostHog page experiment.

Built With

Share this project:

Updates