Skip to content

@posthog/next@1.0.0

Choose a tag to compare

@github-actions github-actions released this 04 Dec 03:04
Immutable release. Only release title and notes can be modified.
b478e29

1.0.0

Major Changes

  • #5971 8752e66 Thanks @dustinbyrne! - Release @posthog/next v1.0.0 breaking changes:
    • Upgrade posthog-node dependency to v6 (Capture v1); see https://posthog.com/docs/libraries/node/migration if you use getPostHog(), serverOptions, or a custom reverse proxy
    • Unify middleware and server consent configuration onto consent?: ConsentConfig (replacing consentCookieName / consentCookiePrefix, enforcing server-side opt-out, and making seedAnonymousCookie: false a pure cookie-seeding toggle)
    • Align PostHogPageView and PostHogProvider defaults with posthog-js: trigger $pageview on initial mount and pathname changes only (call posthog.capture('$pageview') manually if your app relies on query- or hash-triggered pageviews) and strip URL #hash fragments by default (override via clientOptions={{ disable_capture_url_hashes: false }})
    • Reject secret keys (phx_, phs_, etc.) in PostHogProvider and postHogMiddleware, allowlist forwarded proxy headers and validate proxy URLs in postHogMiddleware, and ignore global singleton mutators (register, shutdown, optOut, etc.) on request-scoped server clients (2026-12-04)

Minor Changes

  • #5971 8752e66 Thanks @dustinbyrne! - Add @posthog/next v1.0.0 features:
    • Support projectToken and NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN (deprecating apiKey and NEXT_PUBLIC_POSTHOG_KEY, which continue to work as fallbacks)
    • Enable $pageleave capture while PostHogPageView is mounted (unless capture_pageleave: false), automatically derive ui_host for relative proxy paths, and apply mask_personal_data_properties / custom_personal_data_properties to $pageview $current_url (2026-12-04)

Patch Changes

  • #6053 acdf36a Thanks @dustinbyrne! - Treat empty or unrecognized consent cookie values as pending in isOptedOut, deferring to opt_out_capturing_by_default to match the browser SDK's ConsentManager.
    (2026-12-04)

  • #5971 8752e66 Thanks @dustinbyrne! - Preserve Next.js basePath and trailing slashes in PostHogPageView $current_url, route /static/* and /array/* middleware proxy paths to PostHog assets hosts, fix withContext proxy nesting, deduplicate clientCache initialization, and sanitize tracing headers
    (2026-12-04)

  • Updated dependencies [acdf36a, f36bb04]:

    • @posthog/core@1.71.1
    • posthog-js@1.457.6
    • @posthog/browser-common@0.15.4