Integrate
Analytics
Setting up Analytics with PostHog
PostHog Setup
- Create a PostHog Account and create a project
- Go to Project Settings and copy your
Project API Key
- Install the posthog client library
Adding PostHog to your app
Create a
layout.js
at the root of your project and paste the below, replacing the placeholder text with your project api key.Checking Events
- Restart your app and go back to your main landing page, you should start to see page events autocaptured into your PostHog dashboard.
TIPBy default user session recording is not enabled. You can go to
Project Settings ->Session Replay
and toggle onuser sessions
to see live recordings of users interacting with your site! To further identify users, add A/B testing and feature flags, check out this Tutorial.