---
name: PostHog JS
slug: posthog-js
type: github
source_url: https://github.com/PostHog/posthog-js
changelog_url: https://github.com/PostHog/posthog-js/blob/HEAD/CHANGELOG.md
organization: PostHog
organization_slug: posthog
total_releases: 2162
latest_version: @posthog/mcp@1.0.0
latest_date: 2026-11-06
last_updated: 2026-11-06
tracking_since: 2026-02-25
canonical: https://releases.sh/posthog/posthog-js
organization_url: https://releases.sh/posthog
---

<Summary type="rolling" window-days="90" release-count="200">
PostHog JS continued optimizing for bundle size and tree-shaking while strengthening reliability across recording and error handling. The browser SDK shipped improvements to memory management in session replay, particularly fixing canvas recording leaks on Safari and updating rrweb dependencies. Core SDK work focused on feature flag caching, session recording sampling, and better error detection—including a new `rrweb_error` status when session recording initialization fails silently. On the backend, the team added NestJS integration with context propagation, introduced `feature_flag_cache_ttl_ms` to prevent stale flag values, and expanded feature flag evaluation with semver comparison operators. Tree-shaking support expanded across surveys, toolbar, exceptions, conversations, logs, and experiments, with new configuration options like `advanced_feature_flags_dedup_per_session` and serviceName for logs. Infrastructure work included fixes for sourcemap upload via stdin and better handling of OpenTelemetry exports that don't require optional dependencies to be installed.
</Summary>

<Summary type="monthly" period="February 2026" release-count="25">
February pushed recorder stability and feature flag control. The SDK waited for fresh config before recording starts and added a new recorder status for better visibility, while two new configuration options—`feature_flag_cache_ttl_ms` and `remote_config_refresh_interval_ms`—let developers prevent stale flag values in long-running sessions. Device detection improved to correctly identify Android tablets sending desktop user agents via Client Hints, product tours gained device-type targeting, and the Node SDK introduced context-sensitive flag methods that read `distinctId` from async context instead of requiring it as a parameter.
</Summary>

<Release version="@posthog/mcp@1.0.0" date="November 6, 2026" published="2026-11-06T21:40:46.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/mcp%401.0.0">
## 1.0.0

### Major Changes

- [#5584](https://github.com/PostHog/posthog-js/pull/5584) [`650e968`](https://github.com/PostHog/posthog-js/commit/650e968dbc6d7f62af3eaa17299d0e0d1096799a) Thanks [@lucasheriques](https://github.com/lucasheriques)! - Release 1.0.0. The API and the `$mcp_*` events are now stable: a minor or patch release no longer renames or removes an event or property, changes its type, or changes which requests send an event, so your saved insights keep working across upgrades. New events and properties can still arrive in minor releases. Upgrading from 0.x needs no code change.
  (2026-11-06)
</Release>

<Release version="@posthog/mcp@0.26.0" date="November 6, 2026" published="2026-11-06T21:18:17.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/mcp%400.26.0">
## 0.26.0

### Minor Changes

- [#5583](https://github.com/PostHog/posthog-js/pull/5583) [`2a08e91`](https://github.com/PostHog/posthog-js/commit/2a08e91a69b0c1d9e24ccf177505e63f94f139d3) Thanks [@lucasheriques](https://github.com/lucasheriques)! - Aligned with the MCP analytics spec: a call to a tool the server never registered now emits `$mcp_unknown_tool` instead of a failed `$mcp_tool_call`, `llm_model` is advertised as optional, the `get_more_tools` and `send_feedback` annotations now declare that they record data, and the injected `context` argument has a shorter description. A server whose own dispatcher bypasses the MCP SDK's tool registry (such as `@rekog/mcp-nest`) keeps recording calls to unknown names as failed tool calls, since the SDK cannot tell whether such a tool exists. On a low-level server, `resolveOriginalTool` returning `undefined` now marks a failing call as an unknown tool, so return a tool for every name your server serves. Strings cut to a property limit (such as 256 characters for names and 2,048 for intent and error text) now stop exactly at the limit, `...` included, instead of 3 characters past it. `PostHogMCP` capture methods called without a `sessionId` now send a fresh `$session_id` per call, and anonymous calls use it as their distinct id instead of the shared `"anonymous"`. This changes your published tool definitions; if your server is listed in the ChatGPT or Claude directories, those platforms may re-review the updated tools.
  (2026-11-06)
</Release>

<Release version="posthog-js@1.447.3" date="November 6, 2026" published="2026-11-06T12:54:50.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.447.3">
## 1.447.3

### Patch Changes

- [#5562](https://github.com/PostHog/posthog-js/pull/5562) [`8e042cb`](https://github.com/PostHog/posthog-js/commit/8e042cba3dbb63e861f2aaea8612bceea298a1c6) Thanks [@adityareddy-dev](https://github.com/adityareddy-dev)! - Preserve non-empty CDATA content with text masking and rebuild it as text in HTML documents.
  (2026-11-06)
</Release>

<Release version="@posthog/rollup-plugin@1.6.3" date="November 6, 2026" published="2026-11-06T10:03:00.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/rollup-plugin%401.6.3">
## 1.6.3

### Patch Changes

- [#5571](https://github.com/PostHog/posthog-js/pull/5571) [`2eccf01`](https://github.com/PostHog/posthog-js/commit/2eccf019896b2938ca2b98243859a8fd26217451) Thanks [@marandaneto](https://github.com/marandaneto)! - Keep event-mode chunk IDs stable when unrelated lazy chunks are added in Rollup and Vite builds.
  (2026-11-06)
</Release>

<Release version="posthog-js@1.447.2" date="November 6, 2026" published="2026-11-06T08:58:30.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.447.2">
## 1.447.2

### Patch Changes

- [#5561](https://github.com/PostHog/posthog-js/pull/5561) [`ab49034`](https://github.com/PostHog/posthog-js/commit/ab49034bb69cdf840318c6ab824492e76a72751d) Thanks [@adityareddy-dev](https://github.com/adityareddy-dev)! - Mask hidden input values in session replay when `maskAllInputs` is enabled, and accept `hidden` in `maskInputOptions`.
  (2026-11-06)
- Updated dependencies [[`ab49034`](https://github.com/PostHog/posthog-js/commit/ab49034bb69cdf840318c6ab824492e76a72751d)]:
  - @posthog/types@1.421.1
</Release>

<Release version="@posthog/types@1.421.1" date="November 6, 2026" published="2026-11-06T08:57:56.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/types%401.421.1">
## 1.421.1

### Patch Changes

- [#5561](https://github.com/PostHog/posthog-js/pull/5561) [`ab49034`](https://github.com/PostHog/posthog-js/commit/ab49034bb69cdf840318c6ab824492e76a72751d) Thanks [@adityareddy-dev](https://github.com/adityareddy-dev)! - Mask hidden input values in session replay when `maskAllInputs` is enabled, and accept `hidden` in `maskInputOptions`.
  (2026-11-06)
</Release>

<Release version="@posthog/mcp@0.25.2" date="November 6, 2026" published="2026-11-06T08:25:06.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/mcp%400.25.2">
## 0.25.2

### Patch Changes

- [#5545](https://github.com/PostHog/posthog-js/pull/5545) [`28fe8c0`](https://github.com/PostHog/posthog-js/commit/28fe8c0aa0577db27affcc7445ab72d2a1f6ebb2) Thanks [@onmax](https://github.com/onmax)! - Parse Node stack frames for functions named `async` without a leading parenthesis in the filename.
  (2026-11-06)
- Updated dependencies [[`28fe8c0`](https://github.com/PostHog/posthog-js/commit/28fe8c0aa0577db27affcc7445ab72d2a1f6ebb2)]:
  - @posthog/core@1.64.1
  - posthog-node@5.63.1
</Release>

<Release version="@posthog/core@1.64.1" date="November 6, 2026" published="2026-11-06T08:24:51.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/core%401.64.1">
## 1.64.1

### Patch Changes

- [#5545](https://github.com/PostHog/posthog-js/pull/5545) [`28fe8c0`](https://github.com/PostHog/posthog-js/commit/28fe8c0aa0577db27affcc7445ab72d2a1f6ebb2) Thanks [@onmax](https://github.com/onmax)! - Parse Node stack frames for functions named `async` without a leading parenthesis in the filename.
  (2026-11-06)
</Release>

<Release version="posthog-node@5.63.1" date="November 6, 2026" published="2026-11-06T08:24:43.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.63.1">
## 5.63.1

### Patch Changes

- [#5545](https://github.com/PostHog/posthog-js/pull/5545) [`28fe8c0`](https://github.com/PostHog/posthog-js/commit/28fe8c0aa0577db27affcc7445ab72d2a1f6ebb2) Thanks [@onmax](https://github.com/onmax)! - Parse Node stack frames for functions named `async` without a leading parenthesis in the filename.
  (2026-11-06)
- Updated dependencies [[`28fe8c0`](https://github.com/PostHog/posthog-js/commit/28fe8c0aa0577db27affcc7445ab72d2a1f6ebb2)]:
  - @posthog/core@1.64.1
</Release>

<Release version="@posthog/mcp@0.25.1" date="November 6, 2026" published="2026-11-06T00:04:12.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/mcp%400.25.1">
## 0.25.1

### Patch Changes

- [#5573](https://github.com/PostHog/posthog-js/pull/5573) [`88dbf08`](https://github.com/PostHog/posthog-js/commit/88dbf08e319a60ec1f5c4eeaca25a55a3fa54fe6) Thanks [@lucasheriques](https://github.com/lucasheriques)! - Reworded the descriptions of the injected `conversation_id` and `llm_model` arguments and the `get_more_tools` and `send_feedback` virtual tools so they describe the field instead of instructing the model. This changes your published tool definitions; if your server is listed in the ChatGPT or Claude directories, those platforms may re-review the updated tools.
  (2026-11-05)
</Release>

<Release version="posthog-js@1.447.1" date="November 6, 2026" published="2026-11-06T00:03:57.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.447.1">
## 1.447.1

### Patch Changes

- [#5576](https://github.com/PostHog/posthog-js/pull/5576) [`9ee327d`](https://github.com/PostHog/posthog-js/commit/9ee327d090bffbb564627404b9819994c1327dda) Thanks [@lucasheriques](https://github.com/lucasheriques)! - Reworded the description of the `llm_model` argument that `capture_webmcp` adds to WebMCP tools, so it no longer points the model at its system prompt.
  (2026-11-05)
</Release>

<Release version="@posthog/ai@8.18.5" date="November 5, 2026" published="2026-11-05T19:13:47.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/ai%408.18.5">
## 8.18.5

### Patch Changes

- [#5556](https://github.com/PostHog/posthog-js/pull/5556) [`b63702f`](https://github.com/PostHog/posthog-js/commit/b63702f5ae225e7a4b1b8cc9e5bbbb9aa32422d9) Thanks [@eli-r-ph](https://github.com/eli-r-ph)! - Genkit: redact credentials in model messages, so a credential that a tool returns no longer reaches `$ai_input`.
  (2026-11-05)
</Release>

<Release version="posthog-js@1.447.0" date="November 5, 2026" published="2026-11-05T18:49:55.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.447.0">
## 1.447.0

### Minor Changes

- [#5580](https://github.com/PostHog/posthog-js/pull/5580) [`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f) Thanks [@haacked](https://github.com/haacked)! - `metrics.histogram()` accepts a `bounds` option that sets the histogram's bucket boundaries, and `beforeSend` sees and can change them. The first sample of a histogram (name and unit) fixes its bounds until the client resets. A later sample with different bounds is recorded in the fixed buckets and logs a warning, and a sample with invalid bounds is dropped. The experimental `posthog.flags.request.duration` histogram now uses the bounds `[50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1500, 2000, 3000, 5000, 10000]` ms, so its p50 and p95 resolve between 50ms and 5s. This changes the metric's buckets, which its experimental status allows.
  (2026-11-05)

### Patch Changes

- Updated dependencies [[`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f)]:
  - @posthog/core@1.64.0
  - @posthog/types@1.421.0
</Release>

<Release version="@posthog/types@1.421.0" date="November 5, 2026" published="2026-11-05T18:49:54.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/types%401.421.0">
## 1.421.0

### Minor Changes

- [#5580](https://github.com/PostHog/posthog-js/pull/5580) [`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f) Thanks [@haacked](https://github.com/haacked)! - `metrics.histogram()` accepts a `bounds` option that sets the histogram's bucket boundaries, and `beforeSend` sees and can change them. The first sample of a histogram (name and unit) fixes its bounds until the client resets. A later sample with different bounds is recorded in the fixed buckets and logs a warning, and a sample with invalid bounds is dropped. The experimental `posthog.flags.request.duration` histogram now uses the bounds `[50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1500, 2000, 3000, 5000, 10000]` ms, so its p50 and p95 resolve between 50ms and 5s. This changes the metric's buckets, which its experimental status allows.
  (2026-11-05)
</Release>

<Release version="@posthog/core@1.64.0" date="November 5, 2026" published="2026-11-05T18:49:42.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/core%401.64.0">
## 1.64.0

### Minor Changes

- [#5580](https://github.com/PostHog/posthog-js/pull/5580) [`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f) Thanks [@haacked](https://github.com/haacked)! - `metrics.histogram()` accepts a `bounds` option that sets the histogram's bucket boundaries, and `beforeSend` sees and can change them. The first sample of a histogram (name and unit) fixes its bounds until the client resets. A later sample with different bounds is recorded in the fixed buckets and logs a warning, and a sample with invalid bounds is dropped. The experimental `posthog.flags.request.duration` histogram now uses the bounds `[50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1500, 2000, 3000, 5000, 10000]` ms, so its p50 and p95 resolve between 50ms and 5s. This changes the metric's buckets, which its experimental status allows.
  (2026-11-05)

### Patch Changes

- Updated dependencies [[`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f)]:
  - @posthog/types@1.421.0
</Release>

<Release version="posthog-node@5.63.0" date="November 5, 2026" published="2026-11-05T18:49:36.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.63.0">
## 5.63.0

### Minor Changes

- [#5580](https://github.com/PostHog/posthog-js/pull/5580) [`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f) Thanks [@haacked](https://github.com/haacked)! - `metrics.histogram()` accepts a `bounds` option that sets the histogram's bucket boundaries, and `beforeSend` sees and can change them. The first sample of a histogram (name and unit) fixes its bounds until the client resets. A later sample with different bounds is recorded in the fixed buckets and logs a warning, and a sample with invalid bounds is dropped. The experimental `posthog.flags.request.duration` histogram now uses the bounds `[50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1500, 2000, 3000, 5000, 10000]` ms, so its p50 and p95 resolve between 50ms and 5s. This changes the metric's buckets, which its experimental status allows.
  (2026-11-05)

### Patch Changes

- Updated dependencies [[`aa66d4c`](https://github.com/PostHog/posthog-js/commit/aa66d4c676a87298f26b66e36a222b49c582ed0f)]:
  - @posthog/core@1.64.0
</Release>

<Release version="posthog-node@5.62.0" date="November 5, 2026" published="2026-11-05T13:07:56.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.62.0">
## 5.62.0

### Minor Changes

- [#5509](https://github.com/PostHog/posthog-js/pull/5509) [`71c2464`](https://github.com/PostHog/posthog-js/commit/71c24646209d686c39b516c000d3e3412447774b) Thanks [@Silthus](https://github.com/Silthus)! - `posthog.emails.send()` can now send email content your code rendered, such as HTML from React Email. Give the email a `templateKey` and a `subject`, and pass `html`, `text` or both.

  ```ts
  const posthog = new PostHog("phc_...", { secretKey: "phs_..." });

  const { data, error } = await posthog.emails.send({
    to: "user@example.com",
    distinctId: "user_123",
    templateKey: "password-reset",
    subject: "Reset your password",
    html: renderedHtml,
  });
  if (error) throw error;

  // 'delivered', 'bounced', ...
  const { data: status } = await posthog.emails.get(data.id);
  ```

  You need a project secret API key, the kind that starts with `phs_`. Create one under **Project secret API keys** in your project settings. Set its **Transactional email** scope to Write to send emails, or to Read for a key that only reads statuses. Pass it to the client as `secretKey`. Set `appHost` to your PostHog app URL when you self-host PostHog or send through a reverse proxy.

  PostHog records each email's delivery, opens and clicks on the person with that `distinctId`. It groups every email with the same `templateKey`, so you see their metrics and logs in one place. The SDK retries a request that hits a network error, a rate limit or an outage twice by default. Every send carries an idempotency key, so a retry never sends the email twice. Pass your own `idempotencyKey`, such as `welcome:user_123`, and your job runner's retries are safe too.

  A send with your own content also takes `from`, `replyTo` and `captureEngagement: false`. Set `migratedFrom` on the client to tell PostHog which email provider you moved from. A failed call returns an `EmailError` with PostHog's `code` and the HTTP `statusCode`.

  Docs: [Send transactional emails with Node.js](https://posthog.com/docs/workflows/transactional-emails/node) and the [transactional email overview](https://posthog.com/docs/workflows/transactional-emails). (2026-11-05)
</Release>

<Release version="posthog-js@1.446.3" date="November 5, 2026" published="2026-11-05T13:06:36.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.446.3">
## 1.446.3

### Patch Changes

- [#5560](https://github.com/PostHog/posthog-js/pull/5560) [`e22dedb`](https://github.com/PostHog/posthog-js/commit/e22dedbd6f7393e2bcebee84bae6b5185d9fe67a) Thanks [@adityareddy-dev](https://github.com/adityareddy-dev)! - Use native sibling accessors when recording insertion positions so patched DOM getters do not reorder replayed nodes.
  (2026-11-05)
</Release>

<Release version="@posthog/ai@8.18.4" date="November 5, 2026" published="2026-11-05T12:38:20.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/%40posthog/ai%408.18.4">
## 8.18.4

### Patch Changes

- [#5563](https://github.com/PostHog/posthog-js/pull/5563) [`b1bbf31`](https://github.com/PostHog/posthog-js/commit/b1bbf31ab34b99bca0da47ee031fc7b420504f19) Thanks [@pcbeingused333](https://github.com/pcbeingused333)! - Keep the refusal text of OpenAI Responses API outputs instead of dropping it from the captured `$ai_output_choices`
  (2026-11-05)

- [#5555](https://github.com/PostHog/posthog-js/pull/5555) [`a129e9f`](https://github.com/PostHog/posthog-js/commit/a129e9f726c52aa9ab15db949c42b1292df21c84) Thanks [@smitp1402](https://github.com/smitp1402)! - Count Gemini Interactions tool-use tokens in the captured input tokens.
  (2026-11-05)
</Release>

<Release version="posthog-js@1.446.2" date="November 5, 2026" published="2026-11-05T12:37:32.000Z" url="https://github.com/PostHog/posthog-js/releases/tag/posthog-js%401.446.2">
## 1.446.2

### Patch Changes

- [#5542](https://github.com/PostHog/posthog-js/pull/5542) [`7be658c`](https://github.com/PostHog/posthog-js/commit/7be658c34060839750a54bb9d65c5ce1ef89048e) Thanks [@adityareddy-dev](https://github.com/adityareddy-dev)! - Avoid duplicate same-origin iframe observers after full snapshots during session recording.
  (2026-11-05)
</Release>

<Pagination cursor="2026-11-05T12:37:32.000Z|2026-11-05T13:31:50.280Z|rel_URC3-aUjx2o59e7ZbQBIM" next="https://releases.sh/posthog/posthog-js.md?cursor=2026-11-05T12%3A37%3A32.000Z%7C2026-11-05T13%3A31%3A50.280Z%7Crel_URC3-aUjx2o59e7ZbQBIM&limit=20" />
