PostHog is an open-source product analytics platform that offers a suite of tools, including funnels, heat maps, session recording, feature flags and more, all in a single platform.
https://edge-functions-feature-flag-posthog.vercel.sh
Deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-posthog feature-flag-posthog
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-posthog feature-flag-posthog
You'll need to have an account with PostHog. Once that's done, copy the .env.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.example .env.local
Then open .env.local
and set the environment variables to match the host for your PostHog instance and the Project API key available under Project settings - Project API Key.
Next, run Next.js in development mode:
npm install
npm run dev
# or
yarn
yarn dev