Packages

@posthog/next

0.11.1 · 17 Nov 2026MIT95k / weekRepositorynpmAtom feed

Your version

72 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 0.11.x · latest line
  2. 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)

  3. 0.11.0

    3 Nov 2026
    • onRequestError takes 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. New withPostHogProxy captures errors thrown in proxy.ts or middleware without delaying the response. Errors that escape middleware or a proxy are marked unhandled.
      (2026-11-03)

  4. 0.10.x
  5. 0.10.0

    28 Oct 2026
    • Add an optional Node.js App Router span context bridge that reuses the configured PostHog client and request identity.
      (2026-10-28)

  6. 0.9.x
  7. 0.9.0

    1 Sep 2026
    • Add opt-in $route template capture for App Router and Pages Router pageviews.
      (2026-09-01)

  8. 0.8.x
  9. 0.8.6

    20 Aug 2026
    • Removed

      Drop events when a before-send hook throws instead of sending the unmodified event.
      (2026-08-20)

  10. 0.8.5

    19 Aug 2026
    • Fix request routing in the Next.js middleware proxy.
      (2026-08-19)

  11. 0.8.4

    16 Jul 2026
    • 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)

  12. 0.8.3

    16 Jul 2026
    • Removed

      Remove the Pages Router PostHogProvider.bootstrap prop; move its value to clientOptions.bootstrap. For App Router server-evaluated bootstrap, use fresh evaluated flags and payloads while preserving configured identity and session fields.
      (2026-07-16)

  13. 0.8.2

    16 Jul 2026
    • Fix Pages Router SSR feature flag hooks when Node loads the CommonJS posthog-js entrypoint.
      (2026-07-16)

  14. 0.8.1

    14 Jul 2026
    • Dedupe getDistinctId resolution per request in the App Router: repeated getPostHog() calls within one request (e.g. across a layout and its pages) now share a single resolver invocation, keyed on the request's headers() instance.
      (2026-07-14)

  15. 0.8.0

    9 Jul 2026
    • Replace the getPostHog and getServerSidePostHog exports with a createPostHog() factory. Configure PostHog once in a shared module — including an optional getDistinctId resolver that attributes server-side events and feature flags to the authenticated user — and use the returned getPostHog everywhere.

      import 'server-only'
      import { createPostHog } from '@posthog/next'
      
      export const { getPostHog } = createPostHog()

      Pass getDistinctId to 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 returned getPostHog(ctx) requires the GetServerSidePropsContext and 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. getPostHog is still async, ctx is still required in the Pages Router, and per-call apiKey/options move into createPostHog():

      // 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) becomes getPostHog(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 in withContext instead of calling enterContext, which does not propagate back to the caller across the helper's await boundary.
      (2026-07-09)

  16. 0.7.x
  17. 0.7.2

    8 Jul 2026
    • Fix @posthog/next/pages in Pages Router server bundles so server APIs like getServerSideProps resolve correctly instead of importing the client entrypoint.
      (2026-07-08)

  18. 0.7.1

    2 Jul 2026
    • Retry /flags requests that receive HTTP 502 or 504 responses across SDKs that use the shared core flags client.
      (2026-07-02)

  19. 0.7.0

    24 Jun 2026
    • Enable same-origin client-side tracing headers by default
      (2026-06-24)

  20. 0.6.x
  21. 0.6.0

    23 Jun 2026
    • Enable exception capture by default.

  22. 0.5.x
  23. 0.5.0

    23 Jun 2026
    • Add disable_capture_url_hashes to strip URL fragments from automatically captured URLs. It is disabled by default for backwards compatibility, and enabled automatically when config.defaults is '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, replay href URLs, heatmaps, web vitals $current_url, logs url.full, conversations current_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_send to remove or redact sensitive hash values before events are sent. (2026-06-23)

  24. 0.4.x
  25. 0.4.97

    18 Jun 2026
    • Stop sending deprecated no-op top-level type, library, and library_version fields in event batch payloads. Use properties.$lib and properties.$lib_version for SDK metadata; legacy queued library and library_version values are used as fallbacks when the official $ properties are missing.
      (2026-06-18)

  26. 0.4.96

    15 Jun 2026
    • Add missing bugs metadata to package manifests.
      (2026-06-15)

  27. 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

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.