Adds PostHog to the Payload admin panel through the official JavaScript, Node.js and Next.js SDKs. It registers an admin provider automatically and starts sending telemetry once a project API key is set. It also forwards Payload logs, captures REST and browser errors, and can enable PostHog Conversations for in-app support. Requires Payload 3.94.1 or later below version 4.
Native PostHog integration for Payload CMS
Installation
npm i @klnap/payload-posthog0
Stars
0
Forks
0
Open Issues
Yesterday
Last Updated
1.3k
Weekly Downloads
v0.4.5
npm Version
150.4 KB
Unpacked Size
2
Dependencies
00 since Nov 22
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
1.3K+958 since Nov 28
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 1,342 |
| Dec 5, 2026 | 1,027 |
| Dec 4, 2026 | 1,247 |
| Dec 3, 2026 | 1,183 |
| Dec 2, 2026 | 1,162 |
| Dec 1, 2026 | 1,114 |
| Nov 30, 2026 | 433 |
| Nov 29, 2026 | 420 |
| Nov 28, 2026 | 384 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1471159218-root)<a href="https://payloaddirectory.dev/plugins/1471159218-root"><img src="https://payloaddirectory.dev/badge/1471159218-root.svg" alt="Payload Directory"></a>README
Native PostHog integration for Payload CMS.
Bring Product Analytics, Session Replay, Error Tracking, Logs, Feature Flags, and Customer Support into Payload Admin using the official PostHog JavaScript, Node.js, and Next.js SDKs.
Pre-1.0 software
This package is under active development. Its public API may change before version 1.0. Pin an exact version in production and review the changelog before upgrading.
bun add --exact @klnap/payload-posthog
# or
npm install --save-exact @klnap/payload-posthog
Required peer dependencies are normally installed automatically by Bun and modern npm.
See Compatibility for supported dependency versions.
Telemetry starts once
apiKeyis setOrdinary integrations start without further opt-in: Admin pageviews, native autocapture, user identification (the authenticated user's email is sent as a person property by default), Session Replay where the PostHog project enables it, error tracking, and Payload log forwarding. Session Replay recordings show Admin content, and input values other than passwords are not masked by default. Review Default Integrations, Session Replay, and Opt-out before enabling in production.
Create a PostHog project and add its public Project API key to your environment.
NEXT_PUBLIC_POSTHOG_KEY=phc_your_project_key
Register the plugin in your Payload configuration.
import { postHog } from '@klnap/payload-posthog'
import { postgresAdapter } from '@payloadcms/db-postgres'
import { buildConfig } from 'payload'
export default buildConfig({
secret: process.env.PAYLOAD_SECRET!,
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI,
},
}),
collections: [
{
slug: 'users',
auth: true,
fields: [],
},
],
plugins: [
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
}),
],
})
For an existing Payload application, add postHog() to its plugins array.
The plugin registers its Admin provider automatically. Regenerate the Payload import map using your application's usual workflow when necessary.
No additional PostHog provider or manual browser SDK initialization is required.
The plugin does not depend on a particular Payload database adapter.
The default ingestion region is US Cloud unless overridden.
For an EU Cloud project, configure both browser and server ingestion.
The following examples show individual plugin configurations. Extend your existing configuration and retain the appropriate regional hosts.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
clientOptions: {
api_host: 'https://eu.i.posthog.com',
},
serverOptions: {
host: 'https://eu.i.posthog.com',
},
})
| Region | Ingestion host |
|---|---|
| US Cloud | https://us.i.posthog.com |
| EU Cloud | https://eu.i.posthog.com |
| Scope | Setting | Default | Environment variable |
|---|---|---|---|
| Browser | clientOptions.api_host | https://us.i.posthog.com | NEXT_PUBLIC_POSTHOG_HOST, used when api_host is omitted |
| Server | serverOptions.host | https://us.i.posthog.com | Not read by the plugin's Payload server client |
NEXT_PUBLIC_POSTHOG_HOST configures the browser, through @posthog/next, and Next.js request-error capture, through the instrumentation entrypoint. It does not configure the Payload server client, which reads only serverOptions.host. Setting only NEXT_PUBLIC_POSTHOG_HOST to an EU host sends browser and request-error events to EU Cloud and Payload server events to US Cloud, with no error. Set serverOptions.host as well.
Configure serverOptions.host explicitly when using a non-default server ingestion host.
| Integration | Default behavior |
|---|---|
| Admin pageviews | Automatic |
| User identification | Automatic |
| Product Analytics | Native browser SDK |
| Autocapture | Native browser SDK |
| Session Replay | Native recording with password-only input masking |
| Browser Error Tracking | Unhandled errors, unhandled rejections, and console errors |
| Payload REST Error Tracking | Automatic |
| Payload Logs | Automatic for supported Pino loggers |
| Feature Flags | Native client-side evaluation |
| Server flag bootstrap | Optional |
| Customer Support | Requires configuration |
| Next.js request errors | Requires instrumentation |
| Source maps | Requires build-time configuration |
The ordinary telemetry integrations require no additional package-specific opt-in.
Native PostHog settings, consent, sampling, SDK eligibility, and transport availability determine whether individual events and recordings are collected and delivered.
| Integration | Default | Opt-out |
|---|---|---|
| Plugin | Enabled | enabled: false registers nothing |
| Telemetry transmission | Active when apiKey is set | Omit apiKey; keyless mode transmits nothing |
| Admin pageviews | Enabled, plugin-owned | clientOptions.capture_pageview: false, which also disables native pageviews |
| Autocapture | Native SDK behavior | clientOptions.autocapture: false |
| User identification | Enabled | payload.identify.enabled: false |
| Session Replay | Native SDK behavior, subject to project settings | clientOptions.disable_session_recording: true |
| Browser error tracking | Enabled; clientOptions.capture_exceptions applies when set | payload.errorTracking.browser: false |
| Payload REST error tracking | Enabled | payload.errorTracking.enabled: false |
| Payload Logs | Enabled | payload.logs: false |
The native PostHog browser SDK operates throughout Payload Admin, including custom Admin views.
Automatic pageviews are captured on initial load and client navigation. By default, the plugin uses Next.js route templates, such as /admin/[...segments]/, together with supported URL properties.
Native autocapture records eligible interactions according to SDK and project configuration.
Automatic interaction capture does not mean that every Payload CRUD operation is recorded as a business event.
Use usePostHog() from @posthog/next inside a client-side Admin component.
'use client'
import { usePostHog } from '@posthog/next'
export function ExportButton() {
const posthog = usePostHog()
return (
<button
type='button'
onClick={() =>
posthog.capture('report_export_requested', {
format: 'csv',
})
}
>
Export report
</button>
)
}
The example records a request to export a report. Capture a separate completion event after the actual operation succeeds.
Application-specific events remain the responsibility of the host application.
Configure these independently through clientOptions.
| Option | Value | Behavior |
|---|---|---|
capture_pageview | Omitted | Plugin-owned route-template pageviews |
capture_pageview | true | Native SDK pageviews |
capture_pageview | false | Automatic pageviews disabled |
autocapture | Omitted | Native SDK behavior |
autocapture | false | Native autocapture disabled |
When pageview ownership is assigned to the native SDK, the plugin does not mount its own pageview component.
See the PostHog JavaScript SDK for additional analytics methods and options.
Authenticated Payload users are identified automatically.
The canonical PostHog distinct ID combines the authentication collection slug and the Payload user ID.
users:123
Collection-namespaced identifiers distinguish users from different authentication collections.
The plugin identifies the active user, updates supported mapped person properties, and resets the previous identity on logout or account changes.
Native PostHog identity-merging rules remain in effect.
The user's email is mapped by default.
Map additional properties from the authenticated Payload user.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
identify: {
properties: {
name: 'fullName',
department: 'profile.department',
roles: 'roles[].name',
},
},
},
})
| Source path | Example value |
|---|---|
email | [email protected] |
fullName | Alex Smith |
profile.department | Editorial |
roles[].name | ['Editor', 'Publisher'] |
Mappings reference fields already present on the authenticated user.
Supported values are strings, booleans, finite numbers, and arrays of those primitive values.
Missing or unsupported values are omitted.
The plugin does not fetch or populate additional relationships. Array projections require the corresponding objects to be present in the authenticated user data.
Credential-like source paths and prototype-related keys are rejected.
Set payload.identify.enabled: false to disable automatic browser identification.
Conversations requires automatic identification to remain enabled.
Payload REST error tracking derives server identity from the authenticated request user.
Browser-provided distinct IDs are not trusted as server identities.
Valid native session and window metadata may associate server exceptions with corresponding PostHog sessions when available.
Session metadata is correlation information, not proof of identity.
Linking an exception to a session does not guarantee a playable recording of the error; the exception must fall within the recording's playable interval.
Use payloadDistinctId() to construct the same canonical identifier for application-owned server events.
import { payloadDistinctId } from '@klnap/payload-posthog'
const distinctId = payloadDistinctId('users', 123)
The result is users:123.
Use the verified user's actual authentication collection and ID when integrating with an application-owned PostHog Node SDK client.
The helper constructs an identifier. It does not authenticate users or transmit telemetry.
Session Replay uses PostHog's native recorder throughout Payload Admin.
By default, only password inputs are automatically masked. Other input values remain visible, subject to native recording eligibility and privacy controls.
This preserves useful recordings of editorial workflows and Admin interactions.
The plugin does not implement custom sensitive-input detection.
Native recording options remain available through clientOptions.session_recording. Set maskAllInputs: true to enable full input masking.
The plugin explicitly defaults maskAllInputs to false. This local setting takes precedence over full input masking configured in the PostHog project.
Recordings may contain personal data, unpublished editorial content, and other sensitive application information. Configure the native privacy controls appropriate for your application.
Set clientOptions.disable_session_recording: true to disable Session Replay.
See PostHog Session Replay privacy controls.
| Boundary | Integration |
|---|---|
| Browser | Native PostHog exception capture |
| Payload REST | Automatic unexpected-error capture |
| Next.js | Optional request-error instrumentation |
These integrations observe different execution boundaries. Related failures may be captured by more than one integration.
Browser exception capture uses PostHog's native exception-capture integration.
Unhandled errors, unhandled promise rejections, and console.error() calls are captured by default, unless clientOptions.capture_exceptions is set to false.
Console errors may contain sensitive information or duplicate errors captured through other integration boundaries. Avoid logging credentials and sensitive application data.
Disable console error capture while retaining the other default browser exception sources.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
errorTracking: {
browser: {
capture_console_errors: false,
},
},
},
})
payload.errorTracking.browser | Behavior |
|---|---|
| Omitted | Uses clientOptions.capture_exceptions when set; otherwise all three sources enabled |
true | All three browser exception sources enabled |
false | Browser exception capture disabled |
| Configuration object | Override individual browser exception sources |
An explicit payload.errorTracking.browser value takes precedence over clientOptions.capture_exceptions.
Capture handled exceptions through the existing native client.
posthog.captureException(error)
Obtain the client through usePostHog() inside a client-side Admin component.
Unexpected errors passing through Payload's REST error lifecycle are captured automatically.
Expected HTTP 4xx responses are excluded.
The integration uses the authenticated request identity and valid native session and window metadata when available.
Telemetry capture failures do not replace the original Payload error response.
Direct Local API operations, background jobs, and application logs are not automatically treated as REST exceptions.
Use the server-only shouldCapture callback to apply an additional error policy.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
errorTracking: {
shouldCapture: ({ status }) => status !== undefined && status >= 500,
},
},
})
This example captures only errors with an explicit HTTP 5xx status.
The callback receives error, collection when available, and status when available.
It supports synchronous and asynchronous boolean results.
Expected HTTP 4xx filtering occurs before the callback.
Set payload.errorTracking.enabled: false to disable Payload REST exception capture.
Browser exception capture remains independent.
For Next.js request errors, see Next.js Instrumentation.
Supported Payload Pino logger records are forwarded automatically to PostHog Logs.
The integration preserves the existing logger destination, structured fields, and supported Pino configuration.
Use the ordinary Payload logger.
import type { CollectionAfterChangeHook } from 'payload'
export const logDocumentUpdate: CollectionAfterChangeHook = ({ doc, req }) => {
req.payload.logger.info({ documentId: doc.id }, 'Document updated')
return doc
}
Pino's standard log levels are mapped to PostHog severity.
| Pino level | Severity |
|---|---|
trace | Trace |
debug | Debug |
info | Info |
warn | Warning |
error | Error |
fatal | Fatal |
Structured log attributes remain available for filtering and investigation.
Configure the native Logs service name.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
serverOptions: {
logs: {
serviceName: 'payload-admin',
},
},
})
PostHog's Node SDK buffers and delivers logs asynchronously.
Use the optional waitUntil callback to connect pending delivery to a supported host request lifecycle.
For supported Next.js request contexts:
import { postHog } from '@klnap/payload-posthog'
import { after } from 'next/server'
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
logs: {
waitUntil: (promise) => after(() => promise),
},
},
})
The callback must resolve the active request lifecycle when invoked. Do not retain a callback bound to a previous request.
Next.js after() requires a supported execution context and should not be used indiscriminately for startup or background logging.
Buffered delivery is best effort. Process termination and serverless execution limits can prevent pending telemetry from being delivered.
The integration supports Payload's default Pino logger and supported logger options and destination configurations.
Prebuilt logger instances and Payload's sync logger are preserved but not forwarded.
Logs do not automatically inherit request-scoped person, session, or trace identity.
Common credential-like fields are redacted before forwarding. Arbitrary log messages and application-specific attributes may still contain sensitive information.
Set payload.logs: false to disable forwarding.
Payload's existing logger remains operational.
Use native PostHog feature flags directly inside Payload Admin components.
'use client'
import { useFeatureFlag } from '@posthog/next'
export function ReviewPanel() {
const flag = useFeatureFlag('admin-new-review-panel')
if (flag === undefined) {
return null
}
return flag.enabled ? (
<section>New review panel</section>
) : (
<section>Current review panel</section>
)
}
Native feature-flag results expose enabled and, when available, variant and payload.
Boolean and multivariate flags follow PostHog's native evaluation behavior.
Feature flags are not authorization checks. Enforce permissions independently on the server.
Enable native server-side flag bootstrap.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
bootstrapFlags: true,
})
Or configure native bootstrap options.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
bootstrapFlags: {
flags: ['admin-new-review-panel'],
personProperties: {
plan: 'enterprise',
},
},
})
Server bootstrap opts Admin routes into request-time rendering.
It does not automatically receive the authenticated Payload user's identity or mapped person properties.
Without bootstrap, feature evaluation remains client-side.
PostHog Conversations provides in-app customer support inside Payload Admin.
Authenticated users can create support tickets and exchange messages without leaving the application.
Support teams manage conversations in PostHog alongside available analytics, recordings, and error-tracking context.
Add the private secret to your server environment.
POSTHOG_IDENTITY_SECRET=your_identity_verification_secret
Enable Conversations.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
conversations: {
secret: process.env.POSTHOG_IDENTITY_SECRET!,
},
},
})
The plugin verifies the authenticated Payload identity on the server.
Conversations requires automatic identification and an authenticated Payload collection.
The verification secret stays on the server.
The native launcher is visible by default after identity verification and SDK readiness.
Configure payload.conversations.launcher: 'hidden' to hide the default launcher.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
payload: {
conversations: {
secret: process.env.POSTHOG_IDENTITY_SECRET!,
launcher: 'hidden',
},
},
})
Use usePostHogConversations() in a custom Admin component.
'use client'
import { usePostHogConversations } from '@klnap/payload-posthog/client'
export function SupportButton() {
const { canOpen, open } = usePostHogConversations()
return (
<button type='button' disabled={!canOpen} onClick={open}>
Contact support
</button>
)
}
Register the component using Payload's native custom-component configuration.
| Property or method | Description |
|---|---|
status | Current integration state |
canOpen | Verified identity and policy permit opening |
isAvailable | Native SDK availability |
open() | Open the native support panel |
close() | Close the support panel |
show() | Request native widget visibility |
hide() | Hide the widget and cancel a queued open |
open() can queue an opening request while the native SDK is loading.
canOpen represents identity and policy. isAvailable represents native SDK readiness.
| Status | Description |
|---|---|
disabled | Integration or native module disabled |
loading | Identity verification or SDK initialization |
ready | Verified identity and available native SDK |
unavailable | Identity, consent, or SDK state prevents use |
Tickets, messages, widget themes, and other native Conversations functionality remain owned by PostHog.
See PostHog Support.
Capture Next.js request errors using the package's instrumentation entrypoint.
Configure the native ingestion environment.
NEXT_PUBLIC_POSTHOG_KEY=phc_your_project_key
NEXT_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com
import { capturePostHogError, registerPostHog } from '@klnap/payload-posthog/instrumentation'
export async function register() {
await registerPostHog()
}
export async function onRequestError(...args: Parameters<typeof capturePostHogError>) {
await capturePostHogError(...args)
}
Compose these helpers with any existing application instrumentation.
registerPostHog() initializes native request-error handling and accepts optional native OnRequestErrorOptions.
capturePostHogError() accepts the Next.js request-error arguments.
The instrumentation helpers resolve configuration independently of the Payload plugin.
See the Next.js instrumentation convention.
Upload production source maps to PostHog Error Tracking to resolve minified stack traces to their original source.
Install the optional build-time dependency.
bun add @posthog/nextjs-config
# or
npm install @posthog/nextjs-config
Configure the trusted build environment.
POSTHOG_API_KEY=your_personal_api_key
POSTHOG_PROJECT_ID=your_project_id
import { withPostHogConfig } from '@klnap/payload-posthog/next-config'
export default withPostHogConfig(
{},
{
personalApiKey: process.env.POSTHOG_API_KEY!,
projectId: process.env.POSTHOG_PROJECT_ID!,
host: 'https://eu.posthog.com',
sourcemaps: {
enabled: true,
releaseName: 'payload-admin',
deleteAfterUpload: true,
},
}
)
Pass your existing Next.js configuration as the first argument and preserve existing configuration wrappers.
Source-map management hosts differ from telemetry ingestion hosts.
| Region | Management host |
|---|---|
| US Cloud | https://us.posthog.com |
| EU Cloud | https://eu.posthog.com |
The personal API key must have the appropriate Error Tracking permissions.
Keep it private and available only in the trusted build environment.
The helper uploads source maps during builds. It does not expose a runtime upload service.
Verify that deployed exceptions resolve to their original source frames and that private source maps are not publicly served.
See the PostHog source-map guide.
Enable server-side diagnostics.
postHog({
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY,
debug: true,
})
Diagnostics include integration status, identity mappings, resolved person properties, and supported Conversations verification information.
Inspect identity mappings without initializing telemetry.
postHog({
debug: true,
})
Keyless debug mode does not initialize the PostHog browser provider, server client, error capture, Logs forwarding, or Conversations endpoint.
Diagnostics report resolved identity data, not proof of telemetry delivery.
Mapped values may contain personal data. Enable debugging only in an appropriate environment.
postHog() accepts PayloadPostHogOptions and returns a Payload plugin.
| Option | Default | Description |
|---|---|---|
apiKey | undefined | Public PostHog project key |
enabled | true | Enable the integration |
debug | false | Enable server diagnostics |
clientOptions | Plugin and native SDK defaults | Serializable native browser options |
serverOptions | Plugin and native SDK defaults | Serializable native Node SDK options |
bootstrapFlags | Omitted | Native server-side flag bootstrap |
payload | {} | Payload-specific options |
Setting enabled: false disables the integration.
A missing project key disables telemetry. Keyless diagnostics remain available when debugging is enabled.
All options in this table are nested under payload.
| Option | Default | Description |
|---|---|---|
identify.enabled | true | Automatic browser identification |
identify.properties | Email mapping | Map person properties to authenticated user fields |
errorTracking.enabled | true | Automatic Payload REST exception capture |
errorTracking.browser | clientOptions.capture_exceptions if set, otherwise all three exception sources enabled | Browser exception-capture configuration |
errorTracking.shouldCapture | Omitted | Additional server-side error filter |
logs | Enabled | Forward supported Payload Pino logger records |
logs.waitUntil | Omitted | Host lifecycle callback for buffered delivery |
conversations | Omitted | Enable verified Conversations |
conversations.secret | Required when configured | Private identity verification secret |
conversations.launcher | 'visible' | 'visible' or 'hidden' |
identify.properties accepts Record<string, string>.
errorTracking.shouldCapture accepts a synchronous or asynchronous boolean result.
errorTracking.browser accepts a boolean or native exception-capture configuration object.
logs accepts false or a configuration object containing the optional waitUntil callback.
clientOptions accepts serializable configuration from posthog-js.
| Option | Integration default |
|---|---|
capture_pageview | Native pageviews disabled when the plugin owns pageviews |
save_referrer | false |
save_campaign_params | false |
disable_capture_url_hashes | true |
mask_personal_data_properties | true |
custom_personal_data_properties | Built-in and consumer-configured sensitive parameter names |
session_recording.maskAllInputs | false |
session_recording.maskInputOptions | { password: true } |
disable_conversations | true unless Conversations is configured |
Native autocapture, recording eligibility, consent, and feature evaluation remain controlled by the PostHog SDK and project configuration.
serverOptions accepts serializable configuration from posthog-node.
The integration uses a two-second request timeout and three fetch retries unless overridden by supported native options.
Native Logs buffering, batching, and delivery remain owned by the Node SDK.
Both clientOptions and serverOptions must be serializable because supported options cross the Payload provider boundary.
Function-valued native options, including before_send and beforeSend, are not supported through these objects.
The package-specific shouldCapture and waitUntil callbacks remain server-only.
For complete native SDK configuration, see:
| Entrypoint | Public exports |
|---|---|
@klnap/payload-posthog | postHog, payloadDistinctId, PayloadPostHogOptions |
@klnap/payload-posthog/client | usePostHogConversations, PostHogConversationsControls, PostHogConversationsStatus |
@klnap/payload-posthog/admin | PostHogAdminProvider, PostHogAdminProviderProps |
@klnap/payload-posthog/instrumentation | registerPostHog, capturePostHogError |
@klnap/payload-posthog/next-config | withPostHogConfig, PostHogNextConfigOptions |
The root entrypoint provides the Payload plugin and canonical identity helper.
The /client entrypoint provides the Conversations hook for Admin client components.
The /admin entrypoint provides the provider used by Payload's import-map integration. Manual provider registration is not required for ordinary integrations.
The /instrumentation entrypoint provides Next.js request-error helpers.
The /next-config entrypoint exposes the official build-time source-map helper and requires its optional peer dependency.
Use native PostHog hooks and SDK APIs for functionality owned by PostHog.
The public PostHog project key is an ingestion key and is expected to be visible to the browser.
Keep personal API keys, Payload authentication secrets, and Conversations verification secrets private.
The integration provides:
These protections have defined boundaries and do not provide universal secret detection.
Application-specific event properties, editorial content, DOM text, exception messages, and log messages may contain sensitive information.
The browser SDK may persist some values locally before outbound redaction takes place.
Applications remain responsible for appropriate data collection, consent, retention, access controls, and handling of personal data.
Telemetry uses native SDK buffering and retries. Delivery is best effort, not durable or exactly once.
See Security Policy for vulnerability reporting.
The plugin uses native PostHog SDKs without introducing a separate telemetry pipeline.
A historical production browser comparison with active Analytics and Replay measured an additional 7,635 bytes (+0.98%) of same-origin Admin script transfer compared with a direct PostHog SDK integration.
A separate four-run server comparison showed overlapping timing ranges between direct SDK and plugin variants.
These measurements describe specific historical fixtures, not a guarantee of zero overhead or current-version performance.
See Performance for complete measurements, methodology, reproduction instructions, and limitations.
| Dependency | Supported range |
|---|---|
| Node.js | ^24.22.3 or >=26.13.1 |
payload | >=3.94.1 <4 |
@payloadcms/ui | >=3.94.1 <4 |
next | >=16.4.5 <17 |
react | ^19.3.1 |
react-dom | ^19.3.1 |
@posthog/next | >=0.11.0 <1 |
posthog-js | >=1.444.0 <2 |
posthog-node | >=6.0.0 <7 |
@posthog/nextjs-config | >=1.12.2 <2 (optional) |
These are package-declared dependency ranges, not a claim that every possible dependency combination has been tested.
The optional @posthog/nextjs-config peer is required only when using the source-map build helper.
MIT. See LICENSE.
Topics
payload plugin ab
A/B testing with page variants managed in the Payload admin and routed by Next.js middleware at the edge
741.0k/wk37v3
payload plugin analytics
GA4-backed analytics dashboard in the Payload admin with a client-side tracking layer for Next.js front ends
70821/wk37v3
tracking
Tracking global and React providers for PostHog, Google Tag Manager and Vercel Analytics
6132/wk37v3
payload posthog
PostHog integration for Payload with event capture, feature flags, error tracking and admin session replay
519/wk1v3
payload plugin ga4 ecommerce
GA4 reporting dashboards and per-record analytics tabs inside the Payload admin panel
44115/wk10v3
analytics
Analytics Settings global for Google tags, custom scripts, pixels and UTM cookies on Next.js sites, with consent…
77627/wk0v4