posthog-node
6.0.5 · 19 Nov 2026MIT23.9M / weekRepositorynpmAtom feed
370 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
5.52.5
21 Sep 2026Stop dropping long spans that end:
maxSpanAgeMsnow evicts spans only oncemaxLiveSpansis reached, so a span that runs past the age limit and then ends is exported, and its children are no longer orphaned.
(2026-09-21)Respect the definitions response's
property_matching_versionduring local feature flag evaluation. Version 2 uses explicit boolean/string equality and per-member array matching, while missing or other versions retain service legacy matching (including empty-array truthiness). Preserve the version in Node definition caches and Convex persisted definitions, and propagate it through person, group, cohort and dependency evaluation without mixing snapshots during reloads. Existing numeric ambiguity fallback and SemVer parsing policies are unchanged.
(2026-09-21)
Patch Changes
Stop dropping long spans that end:
maxSpanAgeMsnow evicts spans only oncemaxLiveSpansis reached, so a span that runs past the age limit and then ends is exported, and its children are no longer orphaned.
(2026-09-21)Respect the definitions response's
property_matching_versionduring local feature flag evaluation. Version 2 uses explicit boolean/string equality and per-member array matching, while missing or other versions retain service legacy matching (including empty-array truthiness). Preserve the version in Node definition caches and Convex persisted definitions, and propagate it through person, group, cohort and dependency evaluation without mixing snapshots during reloads. Existing numeric ambiguity fallback and SemVer parsing policies are unchanged.
(2026-09-21)
5.52.4
15 Sep 2026Server-side feature flags now resolve in posthog-node and posthog-edge even when a proxy rewrites the request's
User-Agent. Flags restricted to theclientruntime now resolve toundefinedin these SDKs, where a rewrittenUser-Agentpreviously let them through.
(2026-09-15)
Patch Changes
Server-side feature flags now resolve in posthog-node and posthog-edge even when a proxy rewrites the request's
User-Agent. Flags restricted to theclientruntime now resolve toundefinedin these SDKs, where a rewrittenUser-Agentpreviously let them through.
(2026-09-15)
5.52.3
15 Sep 2026Capture causes and AggregateError members with relationship metadata and individual stacks, limiting output to 50 entries and 1,000 member inspections.
(2026-09-15)
Patch Changes
Capture causes and AggregateError members with relationship metadata and individual stacks, limiting output to 50 entries and 1,000 member inspections.
(2026-09-15)
5.52.2
14 Sep 2026Fix Express exception events reporting the initial response status instead of the final HTTP status.
(2026-09-14)
5.52.1
11 Sep 2026Child spans now share their parent's clock, so a child no longer appears to start before or end after its parent by up to a millisecond, or by more when the system clock is adjusted mid-trace.
(2026-09-11)
Patch Changes
Child spans now share their parent's clock, so a child no longer appears to start before or end after its parent by up to a millisecond, or by more when the system clock is adjusted mid-trace.
(2026-09-11)
5.52.0
10 Sep 2026Add experimental distributed tracing to
posthog-node:startSpan,withSpanandgetActiveSpanrecord spans against a newtracesclient option. A service with tracing off still forwards an inboundtraceparent, including from spans nested inside the one that received it, so a distributed trace is not severed. Atraceparentmay be passed as the one-element arrayreq.headersDistinctgives. AbeforeSpanSendhook sees every span before it is exported and may edit or drop it, andmaxAttributesPerSpan,maxEventsPerSpan,maxAttributeValueLength,maxLiveSpansandmaxSpanAgeMsbound what a single span and a single process may hold.
(2026-09-10)Stop a throwing getter in
metrics.resourceAttributesfrom breaking every metrics export — the key is recorded as[Unserializable]instead.
(2026-09-10)Honor
Retry-Afterwhen the ingestion endpoint refuses a logs or metrics batch, instead of retrying on the SDK's own schedule alone. A refusal naming a longer wait extends the one being served, up to five minutes from when it started. Retry delays now carry jitter so clients refused together do not return together, and metrics backs off exponentially across consecutive failures rather than retrying on a fixed interval.
(2026-09-10)
Minor Changes
Add experimental distributed tracing to
posthog-node:startSpan,withSpanandgetActiveSpanrecord spans against a newtracesclient option. A service with tracing off still forwards an inboundtraceparent, including from spans nested inside the one that received it, so a distributed trace is not severed. Atraceparentmay be passed as the one-element arrayreq.headersDistinctgives. AbeforeSpanSendhook sees every span before it is exported and may edit or drop it, andmaxAttributesPerSpan,maxEventsPerSpan,maxAttributeValueLength,maxLiveSpansandmaxSpanAgeMsbound what a single span and a single process may hold.
(2026-09-10)
Patch Changes
Stop a throwing getter in
metrics.resourceAttributesfrom breaking every metrics export — the key is recorded as[Unserializable]instead.
(2026-09-10)Honor
Retry-Afterwhen the ingestion endpoint refuses a logs or metrics batch, instead of retrying on the SDK's own schedule alone. A refusal naming a longer wait extends the one being served, up to five minutes from when it started. Retry delays now carry jitter so clients refused together do not return together, and metrics backs off exponentially across consecutive failures rather than retrying on a fixed interval.
(2026-09-10)Logs and metrics now always send
service.nameandtelemetry.sdk.*, even when aresourceAttributesvalue is too large to encode in full. Previously that value could crowd them out, and the records reached PostHog with no service attribution.
(2026-09-10)Stop sending logs and metrics batches over 10 MiB, or too large to serialize at all, instead of spending a request to discover the endpoint refuses them.
(2026-09-10)
5.51.8
9 Sep 2026error-tracking: Collapse repeated frame cycles in parsed stack traces to reduce grouping differences caused by recursion depth, while preserving distinct throw locations
(2026-09-09)
Patch Changes
error-tracking: Collapse repeated frame cycles in parsed stack traces to reduce grouping differences caused by recursion depth, while preserving distinct throw locations
(2026-09-09)
5.51.7
7 Sep 2026Clarify feature flag return-value terminology across SDK APIs. A
falsevalue is a conclusive off evaluation, whileundefinedmeans no evaluation is available. Remote evaluation omits globally inactive flags, whereas backend local evaluation can resolve cached inactive definitions tofalse.
(2026-09-07)
Patch Changes
Clarify feature flag return-value terminology across SDK APIs. A
falsevalue is a conclusive off evaluation, whileundefinedmeans no evaluation is available. Remote evaluation omits globally inactive flags, whereas backend local evaluation can resolve cached inactive definitions tofalse.
(2026-09-07)
5.51.6
1 Sep 2026Expose exception capture methods through the
IPostHoginterface.
(2026-09-01)
5.51.5
1 Sep 2026Match local feature flag string operators, exact-value coercion, and JSON stringification with the flags service.
(2026-09-01)Change
bigintattributes on logs, metrics and spans to send as an int64 rather than as a string.
(2026-09-01)
Patch Changes
Match local feature flag string operators, exact-value coercion, and JSON stringification with the flags service.
(2026-09-01)Change
bigintattributes on logs, metrics and spans to send as an int64 rather than as a string.
(2026-09-01)
5.51.4
27 Aug 2026Narrow the
pinterestentry in the bot-detection blocklist topinterestbot, so real users on Pinterest's in-app browser (whose UA also contains the substringpinterest) are no longer misclassified as bots and silently excluded from analytics. The crawler's other UA variant remains covered by the existing genericbot.htmentry, so no bot-detection coverage is lost.
(2026-08-27)Honor
evaluationContextsduring local evaluation — flags whose evaluation contexts don't overlap the configured list are no longer evaluated locally and resolve toundefined.
(2026-08-27)
Patch Changes
Narrow the
pinterestentry in the bot-detection blocklist topinterestbot, so real users on Pinterest's in-app browser (whose UA also contains the substringpinterest) are no longer misclassified as bots and silently excluded from analytics. The crawler's other UA variant remains covered by the existing genericbot.htmentry, so no bot-detection coverage is lost.
(2026-08-27)Honor
evaluationContextsduring local evaluation — flags whose evaluation contexts don't overlap the configured list are no longer evaluated locally and resolve toundefined.
(2026-08-27)
5.51.3
27 Aug 2026Treat omitted local evaluation properties as inconclusive for
is_not_set.
(2026-08-27)
Patch Changes
Treat omitted local evaluation properties as inconclusive for
is_not_set.
(2026-08-27)
5.51.2
25 Aug 2026Handle empty feature flag evaluation key scopes without running local or remote evaluation.
(2026-08-25)Share feature flag matching, hashing, variant, and payload evaluation helpers across the Node.js and Convex SDKs without changing their runtime-specific SemVer behavior.
(2026-08-25)
Patch Changes
Handle empty feature flag evaluation key scopes without running local or remote evaluation.
(2026-08-25)Share feature flag matching, hashing, variant, and payload evaluation helpers across the Node.js and Convex SDKs without changing their runtime-specific SemVer behavior.
(2026-08-25)
5.51.1
24 Aug 2026The Node SDK now sends the raw gzip bytes as the request body instead of wrapping them in a
Blob. On Node 24.16 and later, reading aBlobrequest body leaks a nativeBlobReaderthat is never released, so a service callingcapture()andflush()once per request grew by roughly 2.3 KB of heap per event and never gave it back. This completes the work in #4423: switching tonode:zlibremoved the compression-time Blob reads, but the body itself was still a Blob and still got read once per request. Compression behaviour, headers and the wire format are unchanged, and the edge build keeps usingCompressionStream.
(2026-08-24)
Patch Changes
The Node SDK now sends the raw gzip bytes as the request body instead of wrapping them in a
Blob. On Node 24.16 and later, reading aBlobrequest body leaks a nativeBlobReaderthat is never released, so a service callingcapture()andflush()once per request grew by roughly 2.3 KB of heap per event and never gave it back. This completes the work in #4423: switching tonode:zlibremoved the compression-time Blob reads, but the body itself was still a Blob and still got read once per request. Compression behaviour, headers and the wire format are unchanged, and the edge build keeps usingCompressionStream.
(2026-08-24)
5.51.0
24 Aug 2026Fall back to remote evaluation when a requested flag is missing from loaded local definitions. This
changes scoped calls that previously omitted the flag without making a request. (2026-08-24)
5.50.0
21 Aug 2026FeatureFlagEvaluations.isEnabled()now accepts an optionaldefaultValueoption, returned whenever the flag has no value (missing key, not loaded, or a failed request). A flag with a present value — includingfalseand variant strings — always wins overdefaultValue. Purely additive; omitting the option preserves the existingfalse-on-miss behavior.
(2026-08-21)
5.49.4
21 Aug 2026Fix getFeatureFlagResult returning null variant instead of undefined when remotely evaluated
(2026-08-21)
5.49.3
21 Aug 2026Fix logs and metrics being silently dropped when an attribute holds a very large integer, a function, a symbol, a sparse array, or a truncated emoji.
Cap log and metric attributes at 20 levels of nesting, 1,000 entries per object and 10,000 values in total, marking anything beyond as[Truncated].
TypeOtlpAnyValue.intValueasstring | number— code reading that field must handle both. (2026-08-21)
Patch Changes
Fix logs and metrics being silently dropped when an attribute holds a very large integer, a function, a symbol, a sparse array, or a truncated emoji.
Cap log and metric attributes at 20 levels of nesting, 1,000 entries per object and 10,000 values in total, marking anything beyond as[Truncated].
TypeOtlpAnyValue.intValueasstring | number— code reading that field must handle both. (2026-08-21)
5.49.2
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)
5.49.1
14 Aug 2026Normalize capture timestamp overrides to equivalent UTC ISO strings in the browser and Node.js SDKs and shared core.
(2026-08-14)
Patch Changes
Normalize capture timestamp overrides to equivalent UTC ISO strings in the browser and Node.js SDKs and shared core.
(2026-08-14)
5.49.0
13 Aug 2026Public beta
captureAi()/captureAiImmediate(): AI events on a dedicated isolated endpoint with the event UUID returned. NewenableFullAiCaptureoption replaces the internal_useAiLane/_enableMultimodalCapture; wrappers route through the AI endpoint and skip redaction/truncation when set (privacy mode still wins).
(2026-08-13)
Minor Changes
Public beta
captureAi()/captureAiImmediate(): AI events on a dedicated isolated endpoint with the event UUID returned. NewenableFullAiCaptureoption replaces the internal_useAiLane/_enableMultimodalCapture; wrappers route through the AI endpoint and skip redaction/truncation when set (privacy mode still wins).
(2026-08-13)
5.48.2
12 Aug 2026Log shutdown timeouts without rejecting, and correct the Node.js
shutdown()return type toPromise<void>.
(2026-08-12)
Patch Changes
Log shutdown timeouts without rejecting, and correct the Node.js
shutdown()return type toPromise<void>.
(2026-08-12)
5.48.1
6 Aug 2026Enforce configured request timeouts while consuming Capture V1 response bodies.
(2026-08-06)Use Node's zlib gzip implementation for Node SDK payloads to avoid sustained memory growth from frequent Web Streams compression.
(2026-08-06)
Patch Changes
Enforce configured request timeouts while consuming Capture V1 response bodies.
(2026-08-06)Use Node's zlib gzip implementation for Node SDK payloads to avoid sustained memory growth from frequent Web Streams compression.
(2026-08-06)
5.48.0
5 Aug 2026Support the
starts_with,not_starts_with,ends_with, andnot_ends_withproperty filter operators in feature flag local evaluation. Matching is case-insensitive and mirrorsicontains, so flags using these operators no longer fall back to remote evaluation.
(2026-08-05)
5.47.11
5 Aug 2026Keep request timeouts active through response body consumption and clarify eventual event UUID deduplication semantics.
(2026-08-05)
Patch Changes
Keep request timeouts active through response body consumption and clarify eventual event UUID deduplication semantics.
(2026-08-05)
5.47.10
4 Aug 2026Keep
$referring_domainand canonicalutm_*/campaign parameters on minimal$feature_flag_calledevents. Previously the minimal allowlist stripped every campaign parameter, so a flag-called event landing first in a session could set the session's UTM attribution and channel type to NULL in web analytics.
(2026-08-04)
Patch Changes
Keep
$referring_domainand canonicalutm_*/campaign parameters on minimal$feature_flag_calledevents. Previously the minimal allowlist stripped every campaign parameter, so a flag-called event landing first in a session could set the session's UTM attribution and channel type to NULL in web analytics.
(2026-08-04)
5.47.9
4 Aug 2026Fix
enableExceptionAutocapturesuppressing Node's default crash on unhandled promise rejections; fatal rejections instrictorwarn-with-error-codemode and rejections handled by anotherunhandledRejectionlistener are no longer captured.
(2026-08-04)
5.47.8
4 Aug 2026Schedule local feature flag polls after each request settles.
(2026-08-04)
Patch Changes
Schedule local feature flag polls after each request settles.
(2026-08-04)
5.47.7
3 Aug 2026Bound stack source context reads and skip non-regular or oversized files.
(2026-08-03)
5.47.6
3 Aug 2026Clear completed lifecycle timeout handles so successful shutdowns do not leave timers running.
(2026-08-03)
Patch Changes
Clear completed lifecycle timeout handles so successful shutdowns do not leave timers running.
(2026-08-03)
5.47.5
3 Aug 2026personPropertiesandgroupPropertieson the feature flag methods are no longer typed asRecord<string, string>, so numeric and boolean values type-check without a cast. Local evaluation already handled them —matchPropertytakesRecord<string, any>and compares numerically forgt/gte/lt/lte— only the public types disagreed. These now use the sharedPropertiestype (personProperties?: Properties,groupProperties?: Record<string, Properties>), matchingsetPersonPropertiesForFlags/setGroupPropertiesForFlagsso theanycan be narrowed later. Types only, no runtime change.
(2026-08-03)
Patch Changes
personPropertiesandgroupPropertieson the feature flag methods are no longer typed asRecord<string, string>, so numeric and boolean values type-check without a cast. Local evaluation already handled them —matchPropertytakesRecord<string, any>and compares numerically forgt/gte/lt/lte— only the public types disagreed. These now use the sharedPropertiestype (personProperties?: Properties,groupProperties?: Record<string, Properties>), matchingsetPersonPropertiesForFlags/setGroupPropertiesForFlagsso theanycan be narrowed later. Types only, no runtime change.
(2026-08-03)
5.47.4
3 Aug 2026Preserve events added to a full queue while an earlier batch is being flushed.
(2026-08-03)
Patch Changes
Preserve events added to a full queue while an earlier batch is being flushed.
(2026-08-03)
5.47.3
31 Jul 2026Apply the feature flag definition request timeout while consuming the response body.
(2026-07-31)Keep the feature flag definition request timeout active until the request settles.
(2026-07-31)
5.47.2
31 Jul 2026Fix
identify()leaving a user anonymous when the supplied ID already matches the persisted distinct ID (for example after a non-identified bootstrap seeded the same ID). The user is now marked identified and a person-processed$setevent is captured. Ports the same fix from posthog-js (browser) to the shared core used by React Native, Node, and posthog-js-lite.
(2026-07-31)
Patch Changes
Fix
identify()leaving a user anonymous when the supplied ID already matches the persisted distinct ID (for example after a non-identified bootstrap seeded the same ID). The user is now marked identified and a person-processed$setevent is captured. Ports the same fix from posthog-js (browser) to the shared core used by React Native, Node, and posthog-js-lite.
(2026-07-31)
5.47.1
31 Jul 2026Isolate NestJS request context per Observable subscription.
(2026-07-31)
5.47.0
30 Jul 2026Emit the release id that posthog-cli injects into your bundle as
$release_idon$exceptionevents, so PostHog can attach exceptions to a release without joining through symbol sets. AddsgetInjectedReleaseId()to@posthog/core. The property is only attached when an injected release id can be read.
(2026-07-30)
Minor Changes
Emit the release id that posthog-cli injects into your bundle as
$release_idon$exceptionevents, so PostHog can attach exceptions to a release without joining through symbol sets. AddsgetInjectedReleaseId()to@posthog/core. The property is only attached when an injected release id can be read.
(2026-07-30)
5.46.1
23 Jul 2026Normalize V8 Promise combinator stack frames so input indexes are not treated as source filenames.
(2026-07-23)
Patch Changes
Normalize V8 Promise combinator stack frames so input indexes are not treated as source filenames.
(2026-07-23)
5.46.0
20 Jul 2026Send minimal
$feature_flag_calledevents when the server enables itWhen the v2
/flagsresponse carriesminimalFlagCalledEvents: true(or, for posthog-node local evaluation, the flag-definitions payload carriesminimal_flag_called_events: true) and the evaluated flag is not linked to an experiment ($feature_flag_has_experiment === false),$feature_flag_calledevents are rebuilt from a strict allowlist of flag-evaluation, processing-control, and SDK-identity properties. Super properties,$set/$set_once, the$feature/<key>enumeration,$active_feature_flags, and the context envelope are stripped. Any missing signal (no gate on the response, bootstrapped or locally injected flags,has_experimentunknown) falls back to the full event, and experiment-linked flags always send the full envelope. The gate is stored alongside the cached flags (posthog-js persistence, posthog-node poller state) and is server-controlled, with no SDK-side configuration.before_sendruns after the filter and may re-add stripped properties. (2026-07-20)
Minor Changes
Send minimal
$feature_flag_calledevents when the server enables itWhen the v2
/flagsresponse carriesminimalFlagCalledEvents: true(or, for posthog-node local evaluation, the flag-definitions payload carriesminimal_flag_called_events: true) and the evaluated flag is not linked to an experiment ($feature_flag_has_experiment === false),$feature_flag_calledevents are rebuilt from a strict allowlist of flag-evaluation, processing-control, and SDK-identity properties. Super properties,$set/$set_once, the$feature/<key>enumeration,$active_feature_flags, and the context envelope are stripped. Any missing signal (no gate on the response, bootstrapped or locally injected flags,has_experimentunknown) falls back to the full event, and experiment-linked flags always send the full envelope. The gate is stored alongside the cached flags (posthog-js persistence, posthog-node poller state) and is server-controlled, with no SDK-side configuration.before_sendruns after the filter and may re-add stripped properties. (2026-07-20)
5.45.2
16 Jul 2026Avoid Next.js Edge runtime warnings for native compression and fatal error handling.
(2026-07-16)
Patch Changes
Avoid Next.js Edge runtime warnings for native compression and fatal error handling.
(2026-07-16)
5.45.1
16 Jul 2026Fix the default Node.js event flush interval at 5 seconds.
(2026-07-16)
5.45.0
16 Jul 2026Add
$feature_flag_has_experimentto$feature_flag_calledevents$feature_flag_calledevents now carry a$feature_flag_has_experimentboolean sourced from the server'shas_experimentflag metadata (the/flags?v=2response for remote evaluation, the/api/feature_flag/local_evaluationdefinitions for posthog-node local evaluation). The property is only sent when the server explicitly reportshas_experiment; it is omitted entirely when the value is unknown (older servers, missing metadata, bootstrapped or locally injected flags). (2026-07-16)
Minor Changes
Add
$feature_flag_has_experimentto$feature_flag_calledevents$feature_flag_calledevents now carry a$feature_flag_has_experimentboolean sourced from the server'shas_experimentflag metadata (the/flags?v=2response for remote evaluation, the/api/feature_flag/local_evaluationdefinitions for posthog-node local evaluation). The property is only sent when the server explicitly reportshas_experiment; it is omitted entirely when the value is unknown (older servers, missing metadata, bootstrapped or locally injected flags). (2026-07-16)
5.44.0
15 Jul 2026Raise the default
maxQueueSizefrom 1000 to 10000. Backend workloads are more likely to burst-enqueue events synchronously ahead of a flush than browser/mobile clients, so the previous default risked silently dropping events under bursty load. An explicitmaxQueueSizeoption still overrides this default.
(2026-07-15)
Minor Changes
Raise the default
maxQueueSizefrom 1000 to 10000. Backend workloads are more likely to burst-enqueue events synchronously ahead of a flush than browser/mobile clients, so the previous default risked silently dropping events under bursty load. An explicitmaxQueueSizeoption still overrides this default.
(2026-07-15)
5.43.0
15 Jul 2026Add the posthog.metrics API (count, gauge, histogram) to posthog-node — alpha
Backend services can now record metrics through the same statsd-style pre-aggregating client the browser SDK ships, with no OpenTelemetry setup:
const client = new PostHog('phc_...', { metrics: { serviceName: 'billing-worker' } }) client.metrics.count('invoices.processed', 1, { attributes: { plan: 'pro' } }) client.metrics.gauge('queue.depth', 42) client.metrics.histogram('job.duration', 187, { unit: 'ms' })Samples aggregate in memory and flush as OTLP/JSON to
/i/v1/metrics(one data point per series per window). Pending metrics are flushed onshutdown(). Core gains_sendMetricsBatchonPostHogCoreStateless(same outcome contract as_sendLogsBatch) and a sharedresolveMetricsConfig, so any core-based SDK can hostPostHogMetrics. (2026-07-15)
Minor Changes
Add the posthog.metrics API (count, gauge, histogram) to posthog-node — alpha
Backend services can now record metrics through the same statsd-style pre-aggregating client the browser SDK ships, with no OpenTelemetry setup:
const client = new PostHog('phc_...', { metrics: { serviceName: 'billing-worker' } }) client.metrics.count('invoices.processed', 1, { attributes: { plan: 'pro' } }) client.metrics.gauge('queue.depth', 42) client.metrics.histogram('job.duration', 187, { unit: 'ms' })Samples aggregate in memory and flush as OTLP/JSON to
/i/v1/metrics(one data point per series per window). Pending metrics are flushed onshutdown(). Core gains_sendMetricsBatchonPostHogCoreStateless(same outcome contract as_sendLogsBatch) and a sharedresolveMetricsConfig, so any core-based SDK can hostPostHogMetrics. (2026-07-15)
5.42.0
14 Jul 2026Expose the error tracking rate-limiter config via the new
exceptionRateLimiterRefillRateandexceptionRateLimiterBucketSizeoptions. Burst protection is scoped per exception type (each distinct$exceptiontype gets its own token bucket, with no aggregate cap across types), so these let customers with high-cardinality exception types tune the per-type allowance.
(2026-07-14)
Minor Changes
Expose the error tracking rate-limiter config via the new
exceptionRateLimiterRefillRateandexceptionRateLimiterBucketSizeoptions. Burst protection is scoped per exception type (each distinct$exceptiontype gets its own token bucket, with no aggregate cap across types), so these let customers with high-cardinality exception types tune the per-type allowance.
(2026-07-14)
5.41.0
11 Jul 2026Add opt-in Capture V1 support. Set the
POSTHOG_CAPTURE_MODE=v1environment variable to submit analytics events to the Capture V1 endpoint (/i/v1/analytics/events) instead of the legacy/batch/endpoint, on both the batched and immediate send paths. The default remainsv0, so existing behavior is unchanged unless you opt in. Opt-in is env-var-only during the transition (no public option), so nothing on the API surface has to be removed when v1 later becomes the default.Capture V1 uses Bearer auth, lifts legacy
$-sentinel properties into a typedoptionsobject, and does per-event partial retry with exponential backoff clamped againstRetry-After. Dropped and undelivered events are surfaced on the clienterrorchannel as aCaptureV1Error.$ai_*events continue to use the legacy submitter for now, regardless of the capture mode.In
v1mode,$ai_*events are routed to an isolated in-memory queue and flushed independently of the Capture V1 queue, so the two transports never share a batch and a failure on one cannot re-send events already accepted on the other. Each queue keeps its own retry/durability semantics: the legacy queue re-queues on network failure (retrying on later flushes), while the V1 queue exhausts the sender's own attempt budget per cycle and then surfaces the failure rather than re-queuing. (2026-07-11)
Minor Changes
Add opt-in Capture V1 support. Set the
POSTHOG_CAPTURE_MODE=v1environment variable to submit analytics events to the Capture V1 endpoint (/i/v1/analytics/events) instead of the legacy/batch/endpoint, on both the batched and immediate send paths. The default remainsv0, so existing behavior is unchanged unless you opt in. Opt-in is env-var-only during the transition (no public option), so nothing on the API surface has to be removed when v1 later becomes the default.Capture V1 uses Bearer auth, lifts legacy
$-sentinel properties into a typedoptionsobject, and does per-event partial retry with exponential backoff clamped againstRetry-After. Dropped and undelivered events are surfaced on the clienterrorchannel as aCaptureV1Error.$ai_*events continue to use the legacy submitter for now, regardless of the capture mode.In
v1mode,$ai_*events are routed to an isolated in-memory queue and flushed independently of the Capture V1 queue, so the two transports never share a batch and a failure on one cannot re-send events already accepted on the other. Each queue keeps its own retry/durability semantics: the legacy queue re-queues on network failure (retrying on later flushes), while the V1 queue exhausts the sender's own attempt budget per cycle and then surfaces the failure rather than re-queuing. (2026-07-11)
5.40.0
7 Jul 2026Add
secretKeyconfig as the canonical alias for the deprecatedpersonalApiKey(accepts a Personal API Key or Project Secret API Key).
(2026-07-07)
5.39.4
2 Jul 2026Stop duplicating
distinct_idinside/flagsperson properties.
(2026-07-02)
Patch Changes
Stop duplicating
distinct_idinside/flagsperson properties.
(2026-07-02)
5.39.3
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)
5.39.2
1 Jul 2026Make Node
flush()wait for pending asynchronous SDK work before draining the event queue, so events produced by helpers likecaptureException()are not missed. Pending work rejections no longer prevent queued events from flushing.
(2026-07-01)
Patch Changes
Make Node
flush()wait for pending asynchronous SDK work before draining the event queue, so events produced by helpers likecaptureException()are not missed. Pending work rejections no longer prevent queued events from flushing.
(2026-07-01)
5.39.1
30 Jun 2026Call
before_sendfor identify, group identify, and alias events.
(2026-06-30)Safely serialize event batches with circular property references instead of crashing during flush.
(2026-06-30)
Patch Changes
Call
before_sendfor identify, group identify, and alias events.
(2026-06-30)Safely serialize event batches with circular property references instead of crashing during flush.
(2026-06-30)
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.