PostHog

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

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

Terminal window
NEXT_PUBLIC_POSTHOG_KEY=your_key_here

Next, we need to install the PostHog packages:

Terminal window
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.