@posthog/next
0.11.1 · 17 Nov 2026MIT95k / weekRepositorynpmAtom feed
72 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 0.11.x · latest line
0.11.1
17 Nov 2026- Breaking
Require posthog-node 5.58.0 or later, the first version with the span-context helpers they use.
(2026-11-17)
Patch Changes
- Breaking
Require posthog-node 5.58.0 or later, the first version with the span-context helpers they use.
(2026-11-17)
0.11.0
3 Nov 2026onRequestErrortakes identity from PostHog tracing headers before the cookie, drops a cookie session that posthog-js would have ended, and adds the request URL, method, path and user agent. NewwithPostHogProxycaptures errors thrown inproxy.tsor middleware without delaying the response. Errors that escape middleware or a proxy are marked unhandled.
(2026-11-03)
Minor Changes
onRequestErrortakes identity from PostHog tracing headers before the cookie, drops a cookie session that posthog-js would have ended, and adds the request URL, method, path and user agent. NewwithPostHogProxycaptures errors thrown inproxy.tsor middleware without delaying the response. Errors that escape middleware or a proxy are marked unhandled.
(2026-11-03)
- 0.10.x
0.10.0
28 Oct 2026Add an optional Node.js App Router span context bridge that reuses the configured PostHog client and request identity.
(2026-10-28)
Minor Changes
Add an optional Node.js App Router span context bridge that reuses the configured PostHog client and request identity.
(2026-10-28)
- 0.9.x
0.9.0
1 Sep 2026Add opt-in
$routetemplate capture for App Router and Pages Router pageviews.
(2026-09-01)
Minor Changes
Add opt-in
$routetemplate capture for App Router and Pages Router pageviews.
(2026-09-01)
- 0.8.x
0.8.6
20 Aug 2026- Removed
Drop events when a before-send hook throws instead of sending the unmodified event.
(2026-08-20)
Patch Changes
- Removed
Drop events when a before-send hook throws instead of sending the unmodified event.
(2026-08-20)
0.8.5
19 Aug 2026Fix request routing in the Next.js middleware proxy.
(2026-08-19)
Patch Changes
Fix request routing in the Next.js middleware proxy.
(2026-08-19)
0.8.4
16 Jul 2026Let Next.js dynamic rendering bailouts propagate when bootstrapping flags.
(2026-07-16)Require the Pages Router request context in server identity resolver types.
(2026-07-16)
Patch Changes
Let Next.js dynamic rendering bailouts propagate when bootstrapping flags.
(2026-07-16)Require the Pages Router request context in server identity resolver types.
(2026-07-16)
0.8.3
16 Jul 2026- Removed
Remove the Pages Router
PostHogProvider.bootstrapprop; move its value toclientOptions.bootstrap. For App Router server-evaluated bootstrap, use fresh evaluated flags and payloads while preserving configured identity and session fields.
(2026-07-16)
0.8.2
16 Jul 2026Fix Pages Router SSR feature flag hooks when Node loads the CommonJS posthog-js entrypoint.
(2026-07-16)
0.8.1
14 Jul 2026Dedupe
getDistinctIdresolution per request in the App Router: repeatedgetPostHog()calls within one request (e.g. across a layout and its pages) now share a single resolver invocation, keyed on the request'sheaders()instance.
(2026-07-14)
0.8.0
9 Jul 2026Replace the
getPostHogandgetServerSidePostHogexports with acreatePostHog()factory. Configure PostHog once in a shared module — including an optionalgetDistinctIdresolver that attributes server-side events and feature flags to the authenticated user — and use the returnedgetPostHogeverywhere.import 'server-only' import { createPostHog } from '@posthog/next' export const { getPostHog } = createPostHog()Pass
getDistinctIdto resolve identity from your auth session:import 'server-only' import { createPostHog } from '@posthog/next' import { auth } from '@/auth' export const { getPostHog } = createPostHog({ getDistinctId: async () => (await auth())?.user?.id, })In the Pages Router, import from
@posthog/next/pages; the returnedgetPostHog(ctx)requires theGetServerSidePropsContextand passes it to the resolver:import { createPostHog } from '@posthog/next/pages' export const { getPostHog } = createPostHog({ getDistinctId: async (ctx) => ctx ? (await getServerSession(ctx.req, ctx.res, authOptions))?.user?.id : undefined, })Call sites are unchanged apart from the import.
getPostHogis still async,ctxis still required in the Pages Router, and per-callapiKey/optionsmove intocreatePostHog():// Before import { getPostHog } from '@posthog/next' const posthog = await getPostHog(apiKey, { host }) // After import { getPostHog } from '@/lib/posthog' const posthog = await getPostHog()In the Pages Router,
getServerSidePostHog(ctx)becomesgetPostHog(ctx). (2026-07-09)Fix Pages Router server clients to apply request context after async initialization: the Pages Router path of
createPostHog().getPostHog(ctx)now wraps method calls inwithContextinstead of callingenterContext, which does not propagate back to the caller across the helper's await boundary.
(2026-07-09)
Minor Changes
Replace the
getPostHogandgetServerSidePostHogexports with acreatePostHog()factory. Configure PostHog once in a shared module — including an optionalgetDistinctIdresolver that attributes server-side events and feature flags to the authenticated user — and use the returnedgetPostHogeverywhere.import 'server-only' import { createPostHog } from '@posthog/next' export const { getPostHog } = createPostHog()Pass
getDistinctIdto resolve identity from your auth session:import 'server-only' import { createPostHog } from '@posthog/next' import { auth } from '@/auth' export const { getPostHog } = createPostHog({ getDistinctId: async () => (await auth())?.user?.id, })In the Pages Router, import from
@posthog/next/pages; the returnedgetPostHog(ctx)requires theGetServerSidePropsContextand passes it to the resolver:import { createPostHog } from '@posthog/next/pages' export const { getPostHog } = createPostHog({ getDistinctId: async (ctx) => ctx ? (await getServerSession(ctx.req, ctx.res, authOptions))?.user?.id : undefined, })Call sites are unchanged apart from the import.
getPostHogis still async,ctxis still required in the Pages Router, and per-callapiKey/optionsmove intocreatePostHog():// Before import { getPostHog } from '@posthog/next' const posthog = await getPostHog(apiKey, { host }) // After import { getPostHog } from '@/lib/posthog' const posthog = await getPostHog()In the Pages Router,
getServerSidePostHog(ctx)becomesgetPostHog(ctx). (2026-07-09)
Patch Changes
Fix Pages Router server clients to apply request context after async initialization: the Pages Router path of
createPostHog().getPostHog(ctx)now wraps method calls inwithContextinstead of callingenterContext, which does not propagate back to the caller across the helper's await boundary.
(2026-07-09)
- 0.7.x
0.7.2
8 Jul 2026Fix
@posthog/next/pagesin Pages Router server bundles so server APIs likegetServerSidePropsresolve correctly instead of importing the client entrypoint.
(2026-07-08)
0.7.1
2 Jul 2026Retry
/flagsrequests that receive HTTP 502 or 504 responses across SDKs that use the shared core flags client.
(2026-07-02)
Patch Changes
Retry
/flagsrequests that receive HTTP 502 or 504 responses across SDKs that use the shared core flags client.
(2026-07-02)
0.7.0
24 Jun 2026Enable same-origin client-side tracing headers by default
(2026-06-24)
- 0.6.x
0.6.0
23 Jun 2026Enable exception capture by default.
Minor Changes
Enable exception capture by default.
Client-side PostHog initialization now sets
capture_exceptions: trueby default. PassclientOptions.capture_exceptionsto override this.Apps can export
onRequestErrorfrom@posthog/nextininstrumentation.tsto capture server-side request errors handled by Next.js, including in the Edge runtime.Alternatively, import
captureRequestErrorand call it fromonRequestError. (2026-06-23)
- 0.5.x
0.5.0
23 Jun 2026Add
disable_capture_url_hashesto strip URL fragments from automatically captured URLs. It is disabled by default for backwards compatibility, and enabled automatically whenconfig.defaultsis'2026-06-25'or later. Enabling it (either explicitly or via the'2026-06-25'defaults) is a breaking behavior change for SPAs that rely on URL hashes for routing or analytics, because hash-based routes will be collapsed to the same URL without the fragment in fields such as$current_url,$initial_current_url,$session_entry_url, autocapture$elements[*].attr__href,$external_click_url, replayhrefURLs, heatmaps, web vitals$current_url, logsurl.full, conversationscurrent_url/request_url, or Next.js Pages Router$pageview$current_url.If you only want to capture some hashes, leave hash capture enabled and use
before_sendto remove or redact sensitive hash values before events are sent. (2026-06-23)
Minor Changes
Add
disable_capture_url_hashesto strip URL fragments from automatically captured URLs. It is disabled by default for backwards compatibility, and enabled automatically whenconfig.defaultsis'2026-06-25'or later. Enabling it (either explicitly or via the'2026-06-25'defaults) is a breaking behavior change for SPAs that rely on URL hashes for routing or analytics, because hash-based routes will be collapsed to the same URL without the fragment in fields such as$current_url,$initial_current_url,$session_entry_url, autocapture$elements[*].attr__href,$external_click_url, replayhrefURLs, heatmaps, web vitals$current_url, logsurl.full, conversationscurrent_url/request_url, or Next.js Pages Router$pageview$current_url.If you only want to capture some hashes, leave hash capture enabled and use
before_sendto remove or redact sensitive hash values before events are sent. (2026-06-23)
- 0.4.x
0.4.97
18 Jun 2026Stop sending deprecated no-op top-level
type,library, andlibrary_versionfields in event batch payloads. Useproperties.$libandproperties.$lib_versionfor SDK metadata; legacy queuedlibraryandlibrary_versionvalues are used as fallbacks when the official$properties are missing.
(2026-06-18)
Patch Changes
Stop sending deprecated no-op top-level
type,library, andlibrary_versionfields in event batch payloads. Useproperties.$libandproperties.$lib_versionfor SDK metadata; legacy queuedlibraryandlibrary_versionvalues are used as fallbacks when the official$properties are missing.
(2026-06-18)
0.4.96
15 Jun 2026Add missing bugs metadata to package manifests.
(2026-06-15)
Patch Changes
Add missing bugs metadata to package manifests.
(2026-06-15)
0.4.64 – 0.4.9532 releases that only update dependenciesposthog-js 1.386.3@posthog/core 1.32.3posthog-node 5.36.17and 1 moreShow each
- 0.4.9511 Jun 2026posthog-js 1.386.3@posthog/core 1.32.3posthog-node 5.36.17
- 0.4.9411 Jun 2026@posthog/core 1.32.2posthog-js 1.386.2posthog-node 5.36.16
- 0.4.9310 Jun 2026posthog-js 1.386.1@posthog/core 1.32.1posthog-node 5.36.15
- 0.4.9210 Jun 2026posthog-js 1.386.0@posthog/core 1.32.0posthog-node 5.36.14
- 0.4.9110 Jun 2026posthog-js 1.385.0@posthog/core 1.31.4posthog-node 5.36.13
- 0.4.9010 Jun 2026posthog-js 1.384.3@posthog/core 1.31.3posthog-node 5.36.12
- 0.4.8910 Jun 2026posthog-js 1.384.2@posthog/core 1.31.2posthog-node 5.36.11
- 0.4.8810 Jun 2026posthog-js 1.384.1@posthog/core 1.31.1posthog-node 5.36.10
- 0.4.8710 Jun 2026posthog-js 1.384.0@posthog/core 1.31.0posthog-node 5.36.9
- 0.4.869 Jun 2026posthog-js 1.383.3@posthog/core 1.30.14posthog-node 5.36.8
- 0.4.859 Jun 2026posthog-js 1.383.2posthog-node 5.36.7@posthog/react 1.10.1and 1 more
- 0.4.848 Jun 2026posthog-js 1.383.1@posthog/core 1.30.12posthog-node 5.36.6
- 0.4.838 Jun 2026posthog-js 1.383.0@posthog/core 1.30.11posthog-node 5.36.5
- 0.4.826 Jun 2026posthog-js 1.382.0@posthog/core 1.30.10posthog-node 5.36.4
- 0.4.815 Jun 2026posthog-js 1.381.0@posthog/core 1.30.9posthog-node 5.36.3
- 0.4.805 Jun 2026posthog-js 1.380.1@posthog/core 1.30.8posthog-node 5.36.2
- 0.4.794 Jun 2026posthog-js 1.380.0@posthog/core 1.30.7posthog-node 5.36.1
- 0.4.784 Jun 2026posthog-node 5.36.0
- 0.4.774 Jun 2026posthog-js 1.379.3@posthog/core 1.30.6posthog-node 5.35.15
- 0.4.763 Jun 2026posthog-js 1.379.2@posthog/core 1.30.5posthog-node 5.35.14
- 0.4.753 Jun 2026posthog-js 1.379.1@posthog/core 1.30.4posthog-node 5.35.13
- 0.4.742 Jun 2026posthog-js 1.379.0@posthog/core 1.30.3posthog-node 5.35.12
- 0.4.732 Jun 2026@posthog/react 1.10.0
- 0.4.721 Jun 2026posthog-js 1.378.1@posthog/core 1.30.2posthog-node 5.35.11
- 0.4.711 Jun 2026posthog-js 1.378.0@posthog/core 1.30.1posthog-node 5.35.10
- 0.4.701 Jun 2026posthog-js 1.377.0posthog-node 5.35.9@posthog/core 1.30.0
- 0.4.6931 May 2026posthog-js 1.376.6@posthog/core 1.29.15posthog-node 5.35.8
- 0.4.6831 May 2026posthog-js 1.376.5@posthog/core 1.29.14posthog-node 5.35.7
- 0.4.6728 May 2026posthog-js 1.376.4@posthog/core 1.29.13posthog-node 5.35.6
- 0.4.6627 May 2026posthog-js 1.376.3@posthog/core 1.29.12posthog-node 5.35.5
- 0.4.6526 May 2026posthog-js 1.376.2@posthog/core 1.29.11posthog-node 5.35.4
- 0.4.6426 May 2026@posthog/core 1.29.10posthog-js 1.376.1posthog-node 5.35.3
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.