Remix experiments installation
This guide is for Remix v2. For Remix v3, see our React Router v7 docs. Install the PostHog JavaScript library using your package manager: Add Create a Import the Experiments run on top of our feature flags. You can define which version of your code runs based on the return value of the feature flag. For client-side experiments, use the JavaScript snippet. For server-side experiments, use the Node.js snippet: Once you've implemented the feature flag in your code, you'll enable it for a target audience by creating a new experiment in the PostHog dashboard.Install the package
RequiredConfigure Vite
Requiredposthog-js and posthog-js/react to ssr.noExternal in your vite.config.ts so they get bundled for SSR:Create a provider
Requiredprovider.tsx file in the app folder. Set up the PostHog provider to initialize after hydration:Wrap your app
RequiredPHProvider component in your app/root.tsx file and use it to wrap your app:Implement your experiment
RequiredRun your experiment
RequiredNext steps
RecommendedResource Description Creating an experiment How to create an experiment in PostHog Adding experiment code How to implement experiments for all platforms Statistical significance Understanding when results are meaningful Experiment insights How to analyze your experiment data More tutorials Other real-world examples and use cases