Documentation
Analytics

PostHog

Learn how to use PostHog with supastarter.

To use PostHog with supastarter, first create a PostHog account and get your project key.

Then, add the API key to your .env.local file and your deployment environment:

NEXT_PUBLIC_POSTHOG_KEY=your_key_here

Next, we need to install the PostHog packages:

pnpm add --filter web posthog-js

Finally, we need activate PostHog as the analytics provider. To do this, open apps/web/modules/analytics/index.tsx and change the content to:

export * from "./provider/posthog";

To customize the PostHog configuration, edit the apps/web/modules/analytics/provider/posthog/index.tsx.

Note for EU users: You need to adjust the host url:

posthog.init(posthogKey, {
    api_host: "https://eu.i.posthog.com",
    // ...
});

Learn more about analytics with PostHog in the official documentation.

For further instructions, follow the general analytics instructions.

On this page

No Headings