PostHog JS is a set of JavaScript and TypeScript packages for integrating PostHog into web and other applications. It is useful for sending usage data from your web app or site to PostHog, including autocapture, with supporting packages for frameworks like React and Next.js.
Project status
- Actively maintained. PostHog’s
posthog-jssource shows continuous updates within the last day (for example, 1.398.3 through 1.399.0 on 2026-07-08, plus an upstream push on 2026-07-09), indicating active development rather than maintenance mode. - Update cadence. The recent history includes multiple patch-level updates in short succession (several on 2026-07-08), plus a larger functional update landing as
posthog-js@1.399.0, suggesting a high-frequency release cadence around this period.
AI summary generated
Recent updates
@posthog/core@1.40.2
Release 1.40.2 is primarily an internal refactor in @posthog/core to make batch submission and queue handling overridable and route-partitionable. It also adds groundwork for Capture V1 in posthog-node, ensuring $ai_* events are isolated from the V1 transport.
Featuresposthog-node@5.41.0
posthog-node 5.41.0 adds opt-in Capture V1 support for submitting analytics events to the new endpoint. By default it continues using Capture v0, so existing behavior remains unchanged unless you set an environment variable.
Featuresposthog-js@1.399.2
posthog-js@1.399.2 ships a patch fix for a RangeError: Maximum call stack size exceeded caused by the shared rrweb `patch()` helper leaking wrappers across multiple recorder instances or repeated start/stop cycles. The change modifies how rrweb patches shared globals so out-of-order restores correctly splice wrappers instead of growing an unbounded call chain.
@posthog/react-native-plugin@2.2.1
This release (@posthog/react-native-plugin 2.2.1) is primarily a patch to prevent fatal JS errors from being double-reported on Android minified builds. The code implements the fix by ignoring React Native's JavascriptException at the native error tracking layer and also bumps the bundled posthog-android dependency.
@posthog/mcp@0.9.0
Version 0.9.0 adds stateless, multi-pod compatible MCP session handling by minting and replaying an `Mcp-Session-Id` token during `initialize`, so subsequent requests can recover both the SDK session id and the MCP client name/version without server-side storage. The release also introduces session token codec exports (encode/decode) and a header constant.
Features@posthog/react-native-plugin@2.2.0
This release adds macOS support to the PostHog React Native plugin, enabling it to build for react-native-macos targets. iOS-only PostHog native APIs related to session replay configuration, surveys, and session-recording controls are now guarded with compile-time checks, while macOS support includes native error tracking only.
Featuresposthog-react-native@4.55.0
posthog-react-native@4.55.0 primarily adds a dimmed backdrop behind the survey modal to match existing scrim behavior in the native mobile implementations. However, the included repo diff also contains additional runtime guards and bug fixes in the browser package that are not mentioned in the posthog-react-native release notes.
Featuresposthog-js@1.399.1
posthog-js@1.399.1 release notes describe two browser patch fixes: preventing a TypeError on page unload when a lazy-loaded surveys chunk is version-skewed, and preventing session recording crashes on startup when a CDN-loaded recorder chunk runs against an older core. However, the code diff shows additional, much larger changes across @posthog/next and @posthog/core that are not mentioned in the provided posthog-js release notes.
posthog-react-native@4.54.5
This release includes two documented PostHog core fixes: coalescing concurrent flush requests and preventing shutdown from looping forever when flushes make no queue progress. However, the included code changes also update the Next.js integration package significantly, introducing a createPostHog factory and removing the previous getPostHog/getServerSidePostHog exports from the public barrels, which is not covered in the provided release notes.
@posthog/next@0.8.0
This release changes the @posthog/next integration API from exporting getPostHog and getServerSidePostHog directly, to using a createPostHog() factory that centralizes configuration. It also fixes an issue in the Pages Router where request context was not properly applied after async initialization.
BreakingFeatures@posthog/core@1.40.1
Release @posthog/core@1.40.1 is a patch release focused on improving flush behavior. It coalesces concurrent flush requests to avoid redundant flush chaining, and it prevents shutdown from looping forever when a flush does not make progress draining the queue.
Breaking@posthog/openfeature-node-provider@0.1.0
This release introduces version 0.1.0 of the official PostHog OpenFeature server SDK provider for Node.js. It adds an OpenFeature-compatible provider backed by posthog-node, enabling PostHog feature flag evaluation through OpenFeature.
Features@posthog/core@1.40.0
This release introduces an alpha posthog.metrics API (count, gauge, histogram) with client-side pre-aggregation and periodic flushing as OTLP/JSON to /i/v1/metrics. The implementation adds a new browser extension that wires the metrics feature into the PostHog instance and sends/flushes aggregated payloads through the browser request layer. Release notes only mention the metrics feature and a dependency bump, but the diff also includes unrelated behavioral changes in replay session recording and Next.js module directives.
Features@posthog/types@1.393.0
This release (1.393.0) introduces a new alpha `posthog.metrics` API for client-side, statsd-style pre-aggregated metrics that flush as OTLP/JSON to `/i/v1/metrics`. The codebase adds a full metrics implementation (core aggregator plus browser extension wiring) and exports related metrics types/helpers from the public packages.
Featuresposthog-js@1.399.0
posthog-js@1.399.0 introduces an alpha `posthog.metrics` API (count, gauge, histogram) that pre-aggregates samples in memory and periodically flushes them to `/i/v1/metrics` as OTLP/JSON. The change spans `@posthog/types`, `@posthog/core` (new metrics client), and the browser SDK (new `metrics` extension wired into the default bundles).
Featuresposthog-js@1.398.7
posthog-js@1.398.7 is a patch release focused on fixing a session replay teardown issue for shadow DOM roots inside same-origin iframes. The change ensures shadow-root observers and buffers are disconnected using the shadow root's host ownerDocument, preventing lingering observers after iframe removal.
posthog-js@1.398.6
posthog-js@1.398.6 is a patch release focused on rrweb cleanup robustness, preventing errors when event listeners cannot be removed during rrweb recorder teardown. The code changes introduce a safer removeEventListener helper and wire it into iframe/snapshot cleanup paths, plus add targeted regression tests.
posthog-js@1.398.5
posthog-js@1.398.5 updates the release and publishing tooling so that, when the build emits a code-split ESM toolbar, the full `dist/toolbar/` chunk directory (including the loader and content-hashed chunks/assets) is uploaded to S3/CDN. The production-facing change is primarily about ensuring the toolbar deployment is complete for strict MIME/ESM loading scenarios, while remaining a no-op for the current single-file toolbar build.
posthog-js@1.398.4
posthog-js@1.398.4 is a patch release focused on fixing replay session recordings when the session id rotates while the recorder is idle. The fix ensures the recorder rebinds buffered replay data to the new session id and adds a recovery mechanism so that if an incremental snapshot is shipped without a corresponding full snapshot, a full snapshot is requested.
posthog-js@1.398.3
posthog-js@1.398.3 patches an rrweb session replay issue where Shadow DOM mutations could stop being recorded after an iframe teardown. The fix changes how the shared ShadowDomManager is reset, so tearing down one recording buffer does not disconnect shadow observers for the rest of the page.