Getting Started
Install payload-posthog and wire it into your Payload config.
Installation
npm install payload-posthogQuick start
import { buildConfig } from 'payload'
import { payloadPosthog } from 'payload-posthog'
export default buildConfig({
// ...
plugins: [
payloadPosthog({
apiKey: process.env.POSTHOG_API_KEY!,
// host: 'https://us.i.posthog.com', // default — use https://eu.i.posthog.com for EU Cloud
collections: {
posts: true,
pages: true,
},
}),
],
})With just that, posts and pages emit capture events on create/update/delete,
logins get identified, server errors get reported to PostHog, feature-flag
helpers are ready to import, and the admin panel gets a PostHog-powered
dashboard widget plus session replay.
What's on by default
| Feature | Default |
|---|---|
| Capture | on for collections listed in collections |
| Identify | on |
| Feature flags | on |
| Error tracking | on |
| Client (admin panel) | on |
| Reverse proxy | off — opt in |
| Webhooks | off — requires a handler |
| Groups | off — requires a mapper |
See the configuration reference for the full option set, or jump straight to a feature guide.