@posthog/types
1.427.1 · 23 Nov 2026MIT38.9M / weekRepositorynpmAtom feed
283 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
1.404.0
13 Aug 2026Default external dependency loading to versioned asset paths with automatic fallback to legacy paths, and add a
strict_script_versioning: 'fallback'mode.
(2026-08-13)
1.403.1
13 Aug 2026Harden the session replay stylesheet inlining budget (
inlineStylesheetBudgetRules):
1.403.0
12 Aug 2026browser: Add
rewriteRequestPathto customize API, feature flag, and asset paths for reverse proxies
(2026-08-12)Add reset options for applying bootstrapped identity, feature flag, and session values after
posthog.reset()while preserving the legacy boolean argument.
(2026-08-12)
1.402.3
11 Aug 2026types: Accept current and legacy Segment Analytics SDK types in the Segment integration config
(2026-08-11)
1.402.2
6 Aug 2026Make the session replay attribute masking options mutually exclusive: when both
maskAllElementAttributesandmaskAttributeFnare set, the coarse option wins and the callback is ignored (with a console warning), so a callback can no longer accidentally unmask whatmaskAllElementAttributeshides.
(2026-08-06)
1.402.1
5 Aug 2026replay: Preserve privacy masking for initial network metadata
Initial navigation and performance-timing entries are now passed through
maskCapturedNetworkRequestFn, including when they have no method. URL rewrites are respected. When the callback returns nullish for an initial entry, replay-required timing metadata is retained without its URL, headers, or body so method-gated callbacks do not drop the metadata or expose deliberately filtered customer data. Derived server-timing entries are also suppressed when this strict fallback is used. Enforced PostHog filtering and payload cleaning still run first. (2026-08-05)
1.402.0
5 Aug 2026Add attribute-level masking to session replay:
maskAttributeFnprovides per-attribute control over the final serialized value, whilemaskAllElementAttributesmasks all source DOM string attributes (including rendering attributes and synthesized form values) at the cost of replay fidelity.
(2026-08-05)
1.401.1
5 Aug 2026Keep request timeouts active through response body consumption and clarify eventual event UUID deduplication semantics.
(2026-08-05)
1.401.0
4 Aug 2026Add opt-in
capture_performance.__preview_web_vitals_soft_navsto fix inflated web vitals on single-page appsClient-side route changes in SPAs previously left web vitals (LCP especially) accumulating against the original hard-navigation timestamp, inflating the top tail of Core Web Vitals. Setting
capture_performance: { __preview_web_vitals_soft_navs: true }now scopes metrics to the browser's Soft Navigation entries so each route change starts a fresh measurement window. It's a preview option because it relies on Chrome's experimental Soft Navigation Detection API and loads pinned stable web-vitals 6.x callbacks; when disabled (the default), the existing web-vitals 5.x behavior remains unchanged. (2026-08-04)
1.400.2
4 Aug 2026Report privacy-aware dropped-event count, page and session context in the client rate limit warning
(2026-08-04)
1.400.1
4 Aug 2026Warn when
reset()silently opts the user back outreset()clears stored consent along with the rest of the user's state. Withopt_out_capturing_by_default, this returns the instance to the opted-out default, so callingreset()afteropt_in_capturing()would stop capturing without warning. It now logs a warning when that happens and documents the required ordering. (2026-08-04)
1.400.0
3 Aug 2026Add
session_recording.samplingto disable or throttle mousemove capture (and optionally mouseInteraction) in session replay. Canvas recording now merges its canvas sampling with user-provided sampling instead of overwriting it.
(2026-08-03)
1.399.0
29 Jul 2026Add canvas mask regions to session replay canvas capture:
session_recording.canvasCapture.maskRegionsFnis called once per canvas per captured frame, and the returned regions (CSS pixels, relative to the canvas) are painted black in the captured frame before it is encoded — letting apps that render into canvas (e.g. Flutter web via CanvasKit) mask content that DOM-based masking cannot see.The return value decides what happens to that canvas's frame:
Configuring
maskRegionsFnalso disables canvas pixel serialization in DOM full snapshots (rr_dataURL) — that path never sees the mask regions, so skipping it closes the route that could otherwise embed unmasked canvas stills in a snapshot; the canvas repaints from the masked frame stream instead. Every canvas the provider answers — with regions or `` — re-sends an unchanged frame as a keyframe every 30s, so after a full snapshot or a seek an idle canvas repaints within at most 30s.An app whose real provider only exists once its runtime has booted chooses what happens in between by what it declares in
posthog.init: a function covering the whole canvas blacks those frames out,() => nullskips them, and declaring nothing records them. Client-side only, cannot be set via remote configuration. (2026-07-29)
1.398.0
22 Jul 2026Add a default-value option to
isFeatureEnabledisFeatureEnabled(key, { defaultValue: false })now returns the given default when the flag has no value — flags not loaded yet, or no flag with that key — and the return type narrows toboolean. The option name is the same in posthog-js, posthog-js-lite, and posthog-react-native. WithoutdefaultValue, behavior is unchanged:boolean | undefined. (2026-07-22)
1.397.1
20 Jul 2026Make the pending session recording trigger buffer interval configurable
(2026-07-20)
1.397.0
16 Jul 2026Add dead swipe detection to dead clicks autocapture. When dead clicks autocapture is enabled, touch swipe gestures that produce no observable screen change (no scroll, mutation, selection or visibility change) are now captured as
$dead_swipeevents, surfacing failed navigations on touch devices. Configurable viacapture_dead_swipes(defaulttrue) andswipe_threshold_px(default30) on thecapture_dead_clicksconfig. Swipes over surfaces whose response cannot be observed (canvas, video and other media elements under the finger) are skipped, and captures are limited per page load viamax_dead_swipes_per_page_load(default10).
(2026-07-16)
1.396.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)
1.394.0
14 Jul 2026Normalize the error tracking rate-limiter config to first-class options. The browser SDK now reads
exceptionRateLimiterRefillRate/exceptionRateLimiterBucketSizeonerror_tracking, with the previous double-underscore__exceptionRateLimiterRefillRate/__exceptionRateLimiterBucketSizeoptions deprecated but still honoured as a fallback. The option shape (ExceptionRateLimiterConfig) and default-resolution logic (resolveExceptionRateLimiterConfig) now live in@posthog/coreand are shared between the browser and Node SDKs.
(2026-07-14)
1.393.0
8 Jul 2026Add the posthog.metrics API (count, gauge, histogram) — alpha
A statsd-style pre-aggregating metrics client for the PostHog Metrics product (alpha). Samples are folded into per-series aggregates in memory (counts sum, gauges keep the last value, histograms accumulate buckets) and flushed periodically as OTLP/JSON to
/i/v1/metrics— one data point per series per flush window, no matter how many calls. No OpenTelemetry SDK setup required:posthog.metrics.count('orders_created', 1) posthog.metrics.gauge('active_connections', 42) posthog.metrics.histogram('api_latency', 187, { unit: 'ms' })Configure via
metrics: { serviceName, environment, flushIntervalMs, maxSeriesPerFlush, beforeSend, ... }. (2026-07-08)
1.392.1
3 Jul 2026web: Add a graceful
shutdown()to the browser client for parity with posthog-node, so isomorphic teardown code (e.g. the Nuxt module) that callsposthog.shutdown()on the client no longer throwsTypeError: shutdown is not a function. It best-effort flushes the queued events and always resolves.
(2026-07-03)
1.392.0
29 Jun 2026Add a
get_current_urlconfig option that overrides the URL used for client-side URL targeting — session replay URL triggers, the session replay URL blocklist, survey URL display conditions, product tour URL conditions, web experiment URL conditions, and autocapture URL allow/ignore lists. These match againstwindow.location.hrefdirectly, which does not reflect a$current_urlrewritten inbefore_send. Apps where the browser URL is not meaningful for targeting (e.g. Electron/desktop builds served from a generated host) can now return the logical URL to match against. Defaults towindow.location.hrefwhen not set.
(2026-06-29)
1.391.1
24 Jun 2026Session replay network capture: add an opt-in streaming reader for request/response bodies that stops at the payload size limit instead of buffering the whole body and then discarding it — bounding memory and pre-request latency when a body is very large. It reads only a clone of the body, so it never consumes the stream the page itself reads, and always resolves (never rejects) into the page's
fetch. Off by default; enabled fordefaults: '2026-06-25'and settable directly viasession_recording.streamNetworkBody.
(2026-06-24)
1.391.0
23 Jun 2026Add
disable_capture_url_hashesto strip URL fragments from automatically captured URLs. It is disabled by default for backwards compatibility, and enabled automatically whenconfig.defaultsis'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, replayhrefURLs, heatmaps, web vitals$current_url, logsurl.full, conversationscurrent_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_sendto remove or redact sensitive hash values before events are sent. (2026-06-23)
1.390.2
19 Jun 2026Validate custom event UUID overrides and generate new UUIDs when invalid.
(2026-06-19)
1.390.1
19 Jun 2026replay: Capture canvas at reduced resolution
Adds
session_recording.canvasCapture.resolutionScale- a(0, 1]fraction of the canvas display size to capture replay frames at. The captured bitmap is downscaled (pixel-area savings are quadratic) while the canvas's true display size is still recorded, so playback stretches the smaller frame back to the correct dimensions and aspect ratio - only sharpness drops, never layout. It defaults to1(full resolution, matching today's behaviour), and the latestdefaultsbundle (2026-05-30) opts new installs into0.6.The canvas's true display size travels with each frame through the encode worker (as required message fields), so the encoded reply is always drawn back to the correct dimensions — no per-canvas state is retained on the main thread, and downscaling can never mislabel a canvas's dimensions. At full resolution the captured pixels are unchanged (the quality resampling hint is only applied when actually downscaling); the emitted
drawImagenow always uses the explicit destination-size form, which is pixel-equivalent on replay.Mechanically,
@posthog/rrweb's canvas FPS-snapshot observer takes an optionalcanvasResolutionScalerecord option and downscales each captured frame accordingly. (2026-06-19)
1.390.0
17 Jun 2026Add a
beforeSendoption to the logs config, so you can inspect, redact, or drop log records before they're sent:posthog.init('<token>', { logs: { beforeSend: (log) => { // return null to drop the log, or return the (optionally modified) log to keep it if (log.body.includes('password')) { return null } return log }, }, })beforeSendaccepts a single function or an array of functions (applied left to right); returningnullfrom any of them drops the record. It runs for logs sent via bothposthog.captureLog()andposthog.logger.*. (2026-06-17)
1.389.0
17 Jun 2026The browser's programmatic logs API (
posthog.captureLog()/posthog.logger.*) now runs through the shared@posthog/corelogs pipeline that React Native already uses — no change to the public API or existing behavior. Log delivery is more resilient as a result: oversized batches are split automatically, failed sends retry with exponential backoff, and delivery resumes when the browser comes back online.
(2026-06-17)
1.388.0
17 Jun 2026Add autocapture-only CSS selector opt-outs for web interactions.
(2026-06-17)
1.387.0
16 Jun 2026Add
unsetPersonProperties()to remove person properties, the counterpart tosetPersonProperties(). Previously the only way to unset a person property was to hand-pass a$unsetarray inside acapture()call.
(2026-06-16)Add
$unsetto capture options and pass it through in browser capture payloads.
(2026-06-16)
1.386.4
15 Jun 2026Add missing bugs metadata to package manifests.
(2026-06-15)
1.386.3
11 Jun 2026sessionid: Keep the session id stable across tabs
A session now rotates only when every tab has been idle past the timeout, rather than whenever a single background tab decides it is idle. On the active event path an idle tab re-reads the session id from storage before rotating: if a sibling tab kept the session alive it does not rotate, and if a sibling already rotated it adopts that id instead of minting a new one. This removes spurious cross-tab session fragmentation (inflated session counts, truncated session durations, split replays). When a sibling session is adopted,
onSessionIdhandlers fire withchangeReason.crossTabAdoption: trueso session recording, pageview state, and session-scoped properties follow the new session. Whenpersistence_save_debounce_ms > 0(the2026-05-30default) the refresh reads only the session-id key so it cannot clobber a sibling's write.Note: projects with significant multi-tab usage will see fewer but longer sessions after upgrading — this is a correction of previously over-counted sessions, not a traffic change. (2026-06-11)
1.385.0
10 Jun 2026Promote external dependency script versioning to supported
strict_script_versioningandasset_hostconfig options.
(2026-06-10)Reload feature flags by default when resetting person properties for flags.
(2026-06-10)
1.384.3
10 Jun 2026- Deprecated
Deprecate
__preview_disable_beaconin favor ofdisable_beaconand mark__preview_disable_xhr_credentialsas a no-op.
(2026-06-10)
1.384.2
10 Jun 2026- Deprecated
Deprecate
__preview_eager_load_replayas a no-op now that session replay lazy loading is the default.
(2026-06-10)
1.384.1
10 Jun 20261.384.0
10 Jun 2026Detect the Google Search App (GSA) as its own
$browservalue (Google Search App) via the cross-platformGSA/UA marker, instead of reporting the embedded webview as Mobile Safari (iOS) or Chrome (Android). Gated behind the newdetect_google_search_appconfig option, which the2026-05-30config defaults opt into automatically — left off otherwise to keep existing browser attribution backwards-compatible.Note:
$browser_versionforGoogle Search Appis not comparable across platforms — iOS yields a version like284.0(fromGSA/284.0.564099828) while Android yields a version like14.21(fromGSA/14.21.20.28.arm64), since Google maintains separate versioning schemes for the two apps. Avoid building cross-platform version dashboards on$browser_versionfor this browser. (2026-06-10)
1.383.3
9 Jun 2026- Deprecated
Deprecate the no-op
__preview_flags_v2browser SDK config option. The SDK already uses the/flags/?v=2endpoint by default.
(2026-06-09)
1.383.0
8 Jun 2026persistence: Add
split_storageconfig option to store the feature-flag config cluster in its own localStorage entry (<name>__flags) instead of the single main persistence blob. This payload is large and changes rarely, so keeping it out of the main blob stops it riding on every high-frequency main-blob write and broadcasting on cross-tabstorageevents. Reads are unchanged: on load the entry is merged back into the in-memory props, and the old main-blob location is read once and migrated forward so upgrades never miss a cached flag. The split only applies when persistence resolves tolocalStorage/localStorage+cookie(it is pointless formemory/sessionStorageand impossible forcookie), andreset()/ opt-out wipe every entry. Defaults tofalsefor backwards compatibility; the new2026-05-30config default opts in automatically.
(2026-06-08)surveys: Extend
split_storageto also move the survey config ($surveys) out of the main persistence blob into its own<name>__surveyslocalStorage entry, on top of the feature-flag split. Surveys now stamp a$surveys_loaded_atfreshness timestamp on every/surveysload — the survey analogue of$feature_flag_evaluated_at— so a stale__surveysentry can no longer win over a fresher survey payload written back into the main blob by a gate-off / older-SDK tab. With no timestamp on either side (migration leftover) the group entry still wins, so the migration path is unchanged. Same backend andreset()/ opt-out semantics as the flag split.
(2026-06-08)
1.382.0
6 Jun 20261.381.0
5 Jun 2026Add
__preview_cookie_wins_on_conflictopt-in config to prefer cookie values over localStorage when merging persistence state inlocalStorage+cookiemode, fixing cross-subdomain identify and session disconnects.
(2026-06-05)
1.380.1
5 Jun 20261.380.0
4 Jun 2026Promote browser tracing header configuration to the public
tracing_headersoption while keepingaddTracingHeadersand__add_tracing_headersas deprecated aliases.
(2026-06-04)
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.