Skip to content

feat(browser): opt-in snippet unload fallback + $sent_send_beacon tagging#4116

Closed
pauldambra wants to merge 4 commits into
mainfrom
posthog-code/snippet-unload-beacon-fallback
Closed

feat(browser): opt-in snippet unload fallback + $sent_send_beacon tagging#4116
pauldambra wants to merge 4 commits into
mainfrom
posthog-code/snippet-unload-beacon-fallback

Conversation

@pauldambra

@pauldambra pauldambra commented Jul 8, 2026

Copy link
Copy Markdown
Member

Problem

On slow connections the snippet queues posthog.capture(...) calls in memory while array.js downloads. If the visitor bounces first, those events are silently lost — customers on high-bounce landing pages perceive this as data loss, and today there is no delivery marker to even measure it.

Separately, nothing marks events that left the browser via the sendBeacon fallback in the SDK's unload flush, so fire-and-forget deliveries are indistinguishable in analysis.

Changes

1. Opt-in snippet companion block: packages/browser/snippet/unload-fallback.js

A self-contained ES5 block customers paste near the snippet (either order; double-paste is harmless). On pagehide, if array.js has not loaded, queued capture calls are sent with navigator.sendBeacon to /e/ (base64 data= body — CORS-safelisted, no preflight at unload), marked $sent_by_snippet_fallback_on_unload: true, and spliced from the queue only after the browser accepts the beacon, so a late-arriving array.js can never double-process them (the drain and handler are both synchronous, so they cannot interleave).

It is deliberately not part of the default snippet — it adds ~1.3 KB gz to every page's HTML, and it trades away guarantees (identity joining, pipeline hooks) that only make sense for sites measurably losing events to bounces. The default snippet is size-guarded to stay untouched (869 B min / 517 B gz).

It refuses to send when the SDK would not, or when it cannot be sure:

  • stored consent is no-like; consent pending with opt_out_capturing_by_default; a queued opt_out_capturing() (last opt_in/opt_out call wins, mirroring the real drain's replay order); DNT with respect_dnt; any cookieless_mode
  • the pipeline is customized: before_send, sanitize_properties, property_blacklist/property_denylist, request_headers, or a queued set_config — bypassing redaction would be worse than losing events
  • traffic looks automated (navigator.webdriver, bot/headless UA), honoring opt_out_useragent_filter: true like the SDK
  • disable_beacon, no sendBeacon, payload over the 64 KB beacon limit (max 50 events; oversize left queued)

Identity: queued identify id > persisted distinct_id (localStorage/sessionStorage/cookie, token-sanitized key, persistence_name honored) > generated personless snippet- id with $process_person_profile: false so bouncing first-time visitors never create junk person profiles. It never writes storage, never logs, and every path is wrapped so it cannot throw into page code.

snippet/README.md documents installation, guarantees, and caveats — the artifact to share with customers.

2. $sent_send_beacon: true on the SDK's beacon transport (src/request.ts)

Tagged once at the transport level, covering all producers (RequestQueue.unload(), RetryQueue.unload(), explicit transport: 'sendBeacon' captures). Gated to /e/ payloads so /s/ snapshots and logs are untouched. Zero existing snapshots changed.

3. Reference snippet + loader hardening

snippet/snippet.js is a readable canonical copy of the classic snippet (tested as the exact file), now appending the loader <script> to head instead of insertBefore the first script element — works in script-less documents (e.g. programmatically created iframes). Production source of truth stays in posthog/posthog; grafting head-append there is a follow-up.

Tests: 70 jsdom tests execute the shipped files verbatim (new Function), covering the opt-in property in both directions, wire format, identity matrix, no-send matrix, queued-consent semantics, dedupe against the real init_from_snippet() drain, payload bounds, and minified-parity; a terser+gzip size test enforces byte budgets for both files; 2 chromium Playwright tests cover the slow-array.js fallback + no-double-processing end to end, and the $sent_send_beacon tag on real unload flushes.

Why this lives in posthog-js rather than posthog/posthog: the fallback's contract is entirely SDK internals (the _i tuple shape, __loaded, _execute_array replay order, persistence/consent key formats, the /e/ wire shape), and the key dedupe test imports the real init_from_snippet() from source - a change to any of those internals breaks CI in the same PR here, instead of silently breaking pasted customer code and only surfacing against a released bundle. posthog/posthog gets the distribution surface (docs/UI embedding the minified block) and the production snippet head-append in a follow-up.

Release info Sub-libraries affected

Libraries affected

  • posthog-js (web)

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Built with PostHog Code (Claude). Explored the snippet/transport/persistence/consent mechanics, planned, then implemented TDD (tests red first at each step).
  • Direction changes during the session, driven by review + a threat-modeling pass: the fallback started embedded in the main snippet, then was extracted to a standalone opt-in block over size concerns and the risk that sites won't understand the identity/consent trade-offs; the threat model added the queued-opt-out handling, customized-pipeline skip, bot guard, and payload caps.
  • Notable debugging: headless-browser events are dropped by the SDK's UA bot filter unless opt_out_useragent_filter is set (bit both the e2e fixture and, later, our own bot guard); Playwright served a stale dist/ bundle predating the request.ts change; beacon bodies are only exposed via postDataBuffer() in Chromium.
  • Commits are SSH-signed via the 1Password agent to satisfy the repo's verified-signature rule.

Created with PostHog Code

@pauldambra pauldambra self-assigned this Jul 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63403ce5fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +122 to +124
var consent = local(consentKey)
if (consent == null) {
consent = cookie(consentKey)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor cookie-backed opt-out before beaconing

When opt_out_capturing_persistence_type: 'cookie' is configured, ConsentManager reads the cookie store as the source of truth, but this fallback checks localStorage first and only reads the cookie when local storage is missing. If a visitor has a stale local opt-in value and a current cookie opt-out (0/false), the unload fallback treats consent as granted and sends queued captures anyway, bypassing an explicit opt-out. Please choose the same consent store as the SDK, or at least let any no-like stored consent veto the beacon.

Useful? React with 👍 / 👎.

Comment on lines +150 to +151
var stored =
json(local(storageKey)) || json(session(storageKey)) || json(cookie(storageKey))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use configured persistence when recovering distinct_id

This always probes localStorage, then sessionStorage, then cookies for the persisted distinct_id, regardless of the instance's persistence config. For sites initialized with persistence: 'sessionStorage', 'cookie', or 'memory', a stale localStorage entry from a prior/default setup can cause a bounced event to be attributed to the wrong user and then be removed from the snippet queue, so array.js never gets a chance to send it with the SDK's configured identity semantics. Please select the same backend as PostHogPersistence or avoid persisted IDs when the configured backend is not durable local storage.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

posthog-js Compliance Report

Date: 2026-07-08 19:06:31 UTC
Duration: 88781ms

✅ All Tests Passed!

26/26 tests passed


Capture Tests

26/26 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields Client 97ms
Format Validation.Event Has Uuid 18ms
Format Validation.Event Has Lib Properties 13ms
Format Validation.Distinct Id Is String Client 15ms
Format Validation.Token Is Present Client 16ms
Format Validation.Custom Properties Preserved 14ms
Format Validation.Event Has Timestamp 14ms
Retry Behavior.Retries On 503 5017ms
Retry Behavior.Does Not Retry On 400 2018ms
Retry Behavior.Does Not Retry On 401 2018ms
Retry Behavior.Respects Retry After Header 5018ms
Retry Behavior.Implements Backoff 15029ms
Retry Behavior.Retries On 500 5020ms
Retry Behavior.Retries On 502 5020ms
Retry Behavior.Retries On 504 5020ms
Retry Behavior.Max Retries Respected 15028ms
Deduplication.Generates Unique Uuids 23ms
Deduplication.Preserves Uuid On Retry 5014ms
Deduplication.Preserves Uuid And Timestamp On Retry 10024ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5021ms
Deduplication.No Duplicate Events In Batch 22ms
Deduplication.Different Events Have Different Uuids 13ms
Batch Format.Flush With No Events Sends Nothing 6ms
Error Handling.Does Not Retry On 403 2012ms
Error Handling.Does Not Retry On 413 2017ms
Error Handling.Retries On 408 5018ms

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Size Change: -22.4 kB (-0.13%)

Total Size: 17.1 MB

Filename Size Change
packages/browser/dist/all-external-dependencies.js 236 kB -2.14 kB (-0.9%)
packages/browser/dist/array.full.es5.js 401 kB -2.37 kB (-0.59%)
packages/browser/dist/array.full.js 429 kB -2.46 kB (-0.57%)
packages/browser/dist/array.full.no-********.js 506 kB -3.46 kB (-0.68%)
packages/browser/dist/array.js 217 kB -289 B (-0.13%)
packages/browser/dist/array.no-********.js 241 kB -249 B (-0.1%)
packages/browser/dist/conversations.js 68.3 kB -166 B (-0.24%)
packages/browser/dist/crisp-chat-integration.js 1.97 kB -2 B (-0.1%)
packages/browser/dist/customizations.full.js 19 kB -31 B (-0.16%)
packages/browser/dist/customizations.js 19.1 kB -31 B (-0.16%)
packages/browser/dist/dead-clicks-autocapture.js 14.6 kB -87 B (-0.59%)
packages/browser/dist/default-extensions.js 215 kB -245 B (-0.11%)
packages/browser/dist/element-inference.js 5.69 kB +3 B (+0.05%)
packages/browser/dist/extension-bundles.js 122 kB -442 B (-0.36%)
packages/browser/dist/external-scripts-loader.js 3.1 kB -2 B (-0.06%)
packages/browser/dist/intercom-integration.js 2.02 kB -2 B (-0.1%)
packages/browser/dist/lazy-********.js 160 kB -1.35 kB (-0.84%)
packages/browser/dist/logs.js 4.34 kB -4 B (-0.09%)
packages/browser/dist/main.js 222 kB -259 B (-0.12%)
packages/browser/dist/module.full.js 433 kB -1 kB (-0.23%)
packages/browser/dist/module.full.no-********.js 510 kB -2 kB (-0.39%)
packages/browser/dist/module.js 221 kB -297 B (-0.13%)
packages/browser/dist/module.no-********.js 245 kB -257 B (-0.1%)
packages/browser/dist/module.slim.js 112 kB +420 B (+0.38%)
packages/browser/dist/module.slim.no-********.js 120 kB +700 B (+0.59%)
packages/browser/dist/posthog-********.js 160 kB -1.37 kB (-0.85%)
packages/browser/dist/product-tours-preview.js 76.5 kB -96 B (-0.13%)
packages/browser/dist/product-tours.js 116 kB -154 B (-0.13%)
packages/browser/dist/recorder-v2.js 106 kB -447 B (-0.42%)
packages/browser/dist/recorder.js 106 kB -447 B (-0.42%)
packages/browser/dist/rrweb-plugin-console-record.js 6.64 kB -30 B (-0.45%)
packages/browser/dist/rrweb.js 287 kB -755 B (-0.26%)
packages/browser/dist/surveys-preview.js 77 kB -1.38 kB (-1.77%)
packages/browser/dist/surveys.js 95.6 kB -1.57 kB (-1.62%)
packages/browser/dist/tracing-headers.js 3.64 kB -12 B (-0.33%)
packages/browser/dist/web-vitals-with-attribution.js 12.2 kB -76 B (-0.62%)
packages/browser/dist/web-vitals.js 6.62 kB -48 B (-0.72%)
ℹ️ View Unchanged
Filename Size Change
packages/ai/dist/anthropic/index.cjs 28.2 kB 0 B
packages/ai/dist/anthropic/index.mjs 27.9 kB 0 B
packages/ai/dist/gemini/index.cjs 36.5 kB 0 B
packages/ai/dist/gemini/index.mjs 36.3 kB 0 B
packages/ai/dist/index.cjs 55.2 kB 0 B
packages/ai/dist/index.mjs 55.1 kB 0 B
packages/ai/dist/langchain/index.cjs 34.7 kB 0 B
packages/ai/dist/langchain/index.mjs 34.7 kB 0 B
packages/ai/dist/openai-agents/index.cjs 29.5 kB 0 B
packages/ai/dist/openai-agents/index.mjs 29.4 kB 0 B
packages/ai/dist/openai/index.cjs 78.9 kB 0 B
packages/ai/dist/openai/index.mjs 78.6 kB 0 B
packages/ai/dist/otel/index.cjs 17.2 kB 0 B
packages/ai/dist/otel/index.mjs 17.1 kB 0 B
packages/ai/dist/vercel/index.cjs 47.3 kB 0 B
packages/ai/dist/vercel/index.mjs 47.3 kB 0 B
packages/browser/dist/exception-autocapture.js 11.8 kB 0 B
packages/browser/dist/rrweb-types.js 2.33 kB 0 B
packages/browser/react/dist/esm/index.js 21.1 kB 0 B
packages/browser/react/dist/esm/slim/index.js 17.5 kB 0 B
packages/browser/react/dist/esm/surveys/index.js 4.68 kB 0 B
packages/browser/react/dist/umd/index.js 24.4 kB 0 B
packages/browser/react/dist/umd/slim/index.js 20.3 kB 0 B
packages/browser/react/dist/umd/surveys/index.js 5.45 kB 0 B
packages/convex/dist/client/feature-flags/crypto.js 461 B 0 B
packages/convex/dist/client/feature-flags/evaluator.js 16.5 kB 0 B
packages/convex/dist/client/feature-flags/index.js 196 B 0 B
packages/convex/dist/client/feature-flags/match-********.js 14.8 kB 0 B
packages/convex/dist/client/feature-flags/types.js 44 B 0 B
packages/convex/dist/client/index.js 14.6 kB 0 B
packages/convex/dist/component/_generated/api.js 712 B 0 B
packages/convex/dist/component/_generated/component.js 212 B 0 B
packages/convex/dist/component/_generated/dataModel.js 230 B 0 B
packages/convex/dist/component/_generated/server.js 3.74 kB 0 B
packages/convex/dist/component/convex.config.js 1.66 kB 0 B
packages/convex/dist/component/crons.js 969 B 0 B
packages/convex/dist/component/lib.js 24.7 kB 0 B
packages/convex/dist/component/schema.js 1.17 kB 0 B
packages/convex/dist/component/version.js 68 B 0 B
packages/core/dist/cookie.js 5.34 kB 0 B
packages/core/dist/cookie.mjs 3.12 kB 0 B
packages/core/dist/error-tracking/chunk-ids.js 2.54 kB 0 B
packages/core/dist/error-tracking/chunk-ids.mjs 1.31 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.js 2.3 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.mjs 993 B 0 B
packages/core/dist/error-tracking/coercers/error-coercer.js 2.02 kB 0 B
packages/core/dist/error-tracking/coercers/error-coercer.mjs 794 B 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.js 1.76 kB 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.mjs 513 B 0 B
packages/core/dist/error-tracking/coercers/event-coercer.js 1.82 kB 0 B
packages/core/dist/error-tracking/coercers/event-coercer.mjs 548 B 0 B
packages/core/dist/error-tracking/coercers/index.js 6.79 kB 0 B
packages/core/dist/error-tracking/coercers/index.mjs 326 B 0 B
packages/core/dist/error-tracking/coercers/object-coercer.js 3.46 kB 0 B
packages/core/dist/error-tracking/coercers/object-coercer.mjs 2.07 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.js 1.67 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.mjs 419 B 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.js 2.59 kB 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.mjs 1.25 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.js 2.01 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.mjs 820 B 0 B
packages/core/dist/error-tracking/coercers/utils.js 2.06 kB 0 B
packages/core/dist/error-tracking/coercers/utils.mjs 716 B 0 B
packages/core/dist/error-tracking/error-properties-builder.js 5.56 kB 0 B
packages/core/dist/error-tracking/error-properties-builder.mjs 4.23 kB 0 B
packages/core/dist/error-tracking/exception-steps.js 6.01 kB 0 B
packages/core/dist/error-tracking/exception-steps.mjs 3.84 kB 0 B
packages/core/dist/error-tracking/index.js 4.74 kB 0 B
packages/core/dist/error-tracking/index.mjs 191 B 0 B
packages/core/dist/error-tracking/parsers/base.js 1.83 kB 0 B
packages/core/dist/error-tracking/parsers/base.mjs 464 B 0 B
packages/core/dist/error-tracking/parsers/chrome.js 2.73 kB 0 B
packages/core/dist/error-tracking/parsers/chrome.mjs 1.32 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.js 2.47 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.mjs 1.13 kB 0 B
packages/core/dist/error-tracking/parsers/index.js 4.75 kB 0 B
packages/core/dist/error-tracking/parsers/index.mjs 2.1 kB 0 B
packages/core/dist/error-tracking/parsers/node.js 3.94 kB 0 B
packages/core/dist/error-tracking/parsers/node.mjs 2.68 kB 0 B
packages/core/dist/error-tracking/parsers/opera.js 2.26 kB 0 B
packages/core/dist/error-tracking/parsers/opera.mjs 746 B 0 B
packages/core/dist/error-tracking/parsers/safari.js 1.88 kB 0 B
packages/core/dist/error-tracking/parsers/safari.mjs 574 B 0 B
packages/core/dist/error-tracking/parsers/winjs.js 1.72 kB 0 B
packages/core/dist/error-tracking/parsers/winjs.mjs 426 B 0 B
packages/core/dist/error-tracking/types.js 1.33 kB 0 B
packages/core/dist/error-tracking/types.mjs 131 B 0 B
packages/core/dist/error-tracking/utils.js 1.8 kB 0 B
packages/core/dist/error-tracking/utils.mjs 604 B 0 B
packages/core/dist/eventemitter.js 1.78 kB 0 B
packages/core/dist/eventemitter.mjs 571 B 0 B
packages/core/dist/featureFlagUtils.js 6.42 kB 0 B
packages/core/dist/featureFlagUtils.mjs 3.99 kB 0 B
packages/core/dist/gzip.js 5.72 kB 0 B
packages/core/dist/gzip.mjs 3.84 kB 0 B
packages/core/dist/index.js 15.5 kB 0 B
packages/core/dist/index.mjs 1.52 kB 0 B
packages/core/dist/logs/index.js 10.9 kB 0 B
packages/core/dist/logs/index.mjs 9.22 kB 0 B
packages/core/dist/logs/logs-utils.js 7.01 kB 0 B
packages/core/dist/logs/logs-utils.mjs 4.85 kB 0 B
packages/core/dist/logs/types.js 603 B 0 B
packages/core/dist/logs/types.mjs 0 B 0 B 🆕
packages/core/dist/posthog-core-stateless.js 38.9 kB 0 B
packages/core/dist/posthog-core-stateless.mjs 35.7 kB 0 B
packages/core/dist/posthog-core.js 47.1 kB 0 B
packages/core/dist/posthog-core.mjs 41.7 kB 0 B
packages/core/dist/surveys/events.js 4.21 kB 0 B
packages/core/dist/surveys/events.mjs 1.99 kB 0 B
packages/core/dist/surveys/index.js 4.57 kB 0 B
packages/core/dist/surveys/index.mjs 894 B 0 B
packages/core/dist/surveys/translations.js 10 kB 0 B
packages/core/dist/surveys/translations.mjs 7.55 kB 0 B
packages/core/dist/surveys/validation.js 3.06 kB 0 B
packages/core/dist/surveys/validation.mjs 1.51 kB 0 B
packages/core/dist/testing/index.js 2.93 kB 0 B
packages/core/dist/testing/index.mjs 79 B 0 B
packages/core/dist/testing/PostHogCoreTestClient.js 3.24 kB 0 B
packages/core/dist/testing/PostHogCoreTestClient.mjs 1.83 kB 0 B
packages/core/dist/testing/test-utils.js 2.83 kB 0 B
packages/core/dist/testing/test-utils.mjs 1.15 kB 0 B
packages/core/dist/tracing-headers.js 3.38 kB 0 B
packages/core/dist/tracing-headers.mjs 2.08 kB 0 B
packages/core/dist/types.js 10 kB 0 B
packages/core/dist/types.mjs 7.28 kB 0 B
packages/core/dist/utils/bot-detection.js 3.28 kB 0 B
packages/core/dist/utils/bot-detection.mjs 1.95 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.js 3 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.mjs 1.62 kB 0 B
packages/core/dist/utils/index.js 13.5 kB 0 B
packages/core/dist/utils/index.mjs 2.4 kB 0 B
packages/core/dist/utils/logger.js 2.58 kB 0 B
packages/core/dist/utils/logger.mjs 1.29 kB 0 B
packages/core/dist/utils/number-utils.js 3.32 kB 0 B
packages/core/dist/utils/number-utils.mjs 1.68 kB 0 B
packages/core/dist/utils/promise-queue.js 2.48 kB 0 B
packages/core/dist/utils/promise-queue.mjs 1.25 kB 0 B
packages/core/dist/utils/string-utils.js 3.73 kB 0 B
packages/core/dist/utils/string-utils.mjs 1.97 kB 0 B
packages/core/dist/utils/type-utils.js 7.43 kB 0 B
packages/core/dist/utils/type-utils.mjs 3.28 kB 0 B
packages/core/dist/utils/user-agent-utils.js 17.7 kB 0 B
packages/core/dist/utils/user-agent-utils.mjs 14.2 kB 0 B
packages/core/dist/vendor/uuidv7.js 8.29 kB 0 B
packages/core/dist/vendor/uuidv7.mjs 6.72 kB 0 B
packages/mcp/dist/extensions/capture.js 3.67 kB 0 B
packages/mcp/dist/extensions/capture.mjs 2.23 kB 0 B
packages/mcp/dist/extensions/compatibility.js 5.63 kB 0 B
packages/mcp/dist/extensions/compatibility.mjs 3.79 kB 0 B
packages/mcp/dist/extensions/constants.js 4.64 kB 0 B
packages/mcp/dist/extensions/constants.mjs 2.39 kB 0 B
packages/mcp/dist/extensions/context-parameters.js 3.9 kB 0 B
packages/mcp/dist/extensions/context-parameters.mjs 2.11 kB 0 B
packages/mcp/dist/extensions/conversation-id.js 7.12 kB 0 B
packages/mcp/dist/extensions/conversation-id.mjs 4.21 kB 0 B
packages/mcp/dist/extensions/event-types.js 1.68 kB 0 B
packages/mcp/dist/extensions/event-types.mjs 459 B 0 B
packages/mcp/dist/extensions/exceptions.js 2.57 kB 0 B
packages/mcp/dist/extensions/exceptions.mjs 1.19 kB 0 B
packages/mcp/dist/extensions/ids.js 2.01 kB 0 B
packages/mcp/dist/extensions/ids.mjs 637 B 0 B
packages/mcp/dist/extensions/instrument-highlevel.js 11.3 kB 0 B
packages/mcp/dist/extensions/instrument-highlevel.mjs 8.71 kB 0 B
packages/mcp/dist/extensions/instrument-********.js 4.25 kB 0 B
packages/mcp/dist/extensions/instrument-********.mjs 2.43 kB 0 B
packages/mcp/dist/extensions/instrumentation.js 14.8 kB 0 B
packages/mcp/dist/extensions/instrumentation.mjs 10.6 kB 0 B
packages/mcp/dist/extensions/intent.js 3.31 kB 0 B
packages/mcp/dist/extensions/intent.mjs 1.68 kB 0 B
packages/mcp/dist/extensions/internal.js 6.39 kB 0 B
packages/mcp/dist/extensions/internal.mjs 4.14 kB 0 B
packages/mcp/dist/extensions/lib-********.js 1.6 kB 0 B
packages/mcp/dist/extensions/lib-********.mjs 267 B 0 B
packages/mcp/dist/extensions/logger.js 1.44 kB 0 B
packages/mcp/dist/extensions/logger.mjs 204 B 0 B
packages/mcp/dist/extensions/mcp-********.js 3.93 kB 0 B
packages/mcp/dist/extensions/mcp-********.mjs 2.56 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.js 4.08 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.mjs 2.22 kB 0 B
packages/mcp/dist/extensions/posthog-events.js 10.5 kB 0 B
packages/mcp/dist/extensions/posthog-events.mjs 7.13 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.js 6.6 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.mjs 4.69 kB 0 B
packages/mcp/dist/extensions/sanitization.js 4.04 kB 0 B
packages/mcp/dist/extensions/sanitization.mjs 2.46 kB 0 B
packages/mcp/dist/extensions/session.js 4.78 kB 0 B
packages/mcp/dist/extensions/session.mjs 2.67 kB 0 B
packages/mcp/dist/extensions/sink.js 4.38 kB 0 B
packages/mcp/dist/extensions/sink.mjs 2.54 kB 0 B
packages/mcp/dist/extensions/tools.js 3.5 kB 0 B
packages/mcp/dist/extensions/tools.mjs 1.61 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.js 2.41 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.mjs 772 B 0 B
packages/mcp/dist/extensions/truncation.js 11.2 kB 0 B
packages/mcp/dist/extensions/truncation.mjs 9.54 kB 0 B
packages/mcp/dist/index.js 7.72 kB 0 B
packages/mcp/dist/index.mjs 4.46 kB 0 B
packages/mcp/dist/types.js 603 B 0 B
packages/mcp/dist/types.mjs 0 B 0 B 🆕
packages/mcp/dist/version.js 1.21 kB 0 B
packages/mcp/dist/version.mjs 45 B 0 B
packages/next/dist/app/PostHogProvider.js 3.34 kB 0 B
packages/next/dist/client/ClientPostHogProvider.js 2.37 kB 0 B
packages/next/dist/client/hooks.js 172 B 0 B
packages/next/dist/client/PostHogPageView.js 1.76 kB 0 B
packages/next/dist/index.client.js 401 B 0 B
packages/next/dist/index.edge.js 570 B 0 B
packages/next/dist/index.js 548 B 0 B
packages/next/dist/index.react-server.js 420 B 0 B
packages/next/dist/middleware/postHogMiddleware.js 3.68 kB 0 B
packages/next/dist/pages.client.js 225 B 0 B
packages/next/dist/pages.edge.js 570 B 0 B
packages/next/dist/pages.js 414 B 0 B
packages/next/dist/pages/getServerSidePostHog.js 1.99 kB 0 B
packages/next/dist/pages/PostHogPageView.js 1.55 kB 0 B
packages/next/dist/pages/PostHogProvider.js 1.61 kB 0 B
packages/next/dist/server.edge.js 795 B 0 B
packages/next/dist/server/captureRequestError.js 5.26 kB 0 B
packages/next/dist/server/clientCache.edge.js 305 B 0 B
packages/next/dist/server/clientCache.js 1.27 kB 0 B
packages/next/dist/server/clientCache.node.js 305 B 0 B
packages/next/dist/server/getPostHog.js 2.77 kB 0 B
packages/next/dist/server/onRequestError.js 1.39 kB 0 B
packages/next/dist/server/onRequestError.types.js 59 B 0 B
packages/next/dist/shared/browser.js 195 B 0 B
packages/next/dist/shared/config.js 2.23 kB 0 B
packages/next/dist/shared/constants.js 201 B 0 B
packages/next/dist/shared/cookie.js 540 B 0 B
packages/next/dist/shared/identity.js 264 B 0 B
packages/next/dist/shared/tracing-headers.js 2.18 kB 0 B
packages/nextjs-config/dist/config.js 6.1 kB 0 B
packages/nextjs-config/dist/config.mjs 4.53 kB 0 B
packages/nextjs-config/dist/index.js 2.24 kB 0 B
packages/nextjs-config/dist/index.mjs 30 B 0 B
packages/nextjs-config/dist/strip-sourcemap-********.js 3.63 kB 0 B
packages/nextjs-config/dist/strip-sourcemap-********.mjs 1.77 kB 0 B
packages/nextjs-config/dist/utils.js 2.94 kB 0 B
packages/nextjs-config/dist/utils.mjs 826 B 0 B
packages/node/dist/client.js 50.4 kB 0 B
packages/node/dist/client.mjs 48 kB 0 B
packages/node/dist/entrypoints/index.edge.js 3.85 kB 0 B
packages/node/dist/entrypoints/index.edge.mjs 720 B 0 B
packages/node/dist/entrypoints/index.node.js 5.67 kB 0 B
packages/node/dist/entrypoints/index.node.mjs 1.25 kB 0 B
packages/node/dist/entrypoints/nestjs.js 2.31 kB 0 B
packages/node/dist/entrypoints/nestjs.mjs 42 B 0 B
packages/node/dist/experimental.js 870 B 0 B
packages/node/dist/experimental.mjs 267 B 0 B
packages/node/dist/exports.js 6.75 kB 0 B
packages/node/dist/exports.mjs 582 B 0 B
packages/node/dist/extensions/context/context.js 2.13 kB 0 B
packages/node/dist/extensions/context/context.mjs 863 B 0 B
packages/node/dist/extensions/context/types.js 603 B 0 B
packages/node/dist/extensions/context/types.mjs 0 B 0 B 🆕
packages/node/dist/extensions/error-tracking/autocapture.js 2.66 kB 0 B
packages/node/dist/extensions/error-tracking/autocapture.mjs 1.24 kB 0 B
packages/node/dist/extensions/error-tracking/index.js 4.17 kB 0 B
packages/node/dist/extensions/error-tracking/index.mjs 2.9 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.js 8.81 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs 7.15 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.js 2.78 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.mjs 1.45 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.js 1.97 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs 624 B 0 B
packages/node/dist/extensions/express.js 4.97 kB 0 B
packages/node/dist/extensions/express.mjs 2.78 kB 0 B
packages/node/dist/extensions/feature-flags/cache.js 603 B 0 B
packages/node/dist/extensions/feature-flags/cache.mjs 0 B 0 B 🆕
packages/node/dist/extensions/feature-flags/crypto.js 1.57 kB 0 B
packages/node/dist/extensions/feature-flags/crypto.mjs 395 B 0 B
packages/node/dist/extensions/feature-flags/feature-flags.js 41 kB 0 B
packages/node/dist/extensions/feature-flags/feature-flags.mjs 38.9 kB 0 B
packages/node/dist/extensions/nestjs.js 5.36 kB 0 B
packages/node/dist/extensions/nestjs.mjs 3.18 kB 0 B
packages/node/dist/extensions/sentry-integration.js 4.66 kB 0 B
packages/node/dist/extensions/sentry-integration.mjs 3.17 kB 0 B
packages/node/dist/extensions/tracing-headers.js 3.31 kB 0 B
packages/node/dist/extensions/tracing-headers.mjs 1.53 kB 0 B
packages/node/dist/extensions/url-utils.js 2.22 kB 0 B
packages/node/dist/extensions/url-utils.mjs 785 B 0 B
packages/node/dist/feature-flag-evaluations.js 5.97 kB 0 B
packages/node/dist/feature-flag-evaluations.mjs 4.63 kB 0 B
packages/node/dist/storage-memory.js 1.52 kB 0 B
packages/node/dist/storage-memory.mjs 297 B 0 B
packages/node/dist/types.js 1.43 kB 0 B
packages/node/dist/types.mjs 224 B 0 B
packages/node/dist/version.js 1.21 kB 0 B
packages/node/dist/version.mjs 46 B 0 B
packages/nuxt/dist/module.mjs 5.35 kB 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagEnabled.js 566 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagPayload.js 690 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagVariantKey.js 591 B 0 B
packages/nuxt/dist/runtime/composables/usePostHog.js 128 B 0 B
packages/nuxt/dist/runtime/nitro-plugin.js 1.08 kB 0 B
packages/nuxt/dist/runtime/vue-plugin.js 1.14 kB 0 B
packages/openfeature-web-provider/dist/index.js 1.75 kB 0 B
packages/openfeature-web-provider/dist/index.mjs 184 B 0 B
packages/openfeature-web-provider/dist/mapping.js 5.29 kB 0 B
packages/openfeature-web-provider/dist/mapping.mjs 3.18 kB 0 B
packages/openfeature-web-provider/dist/provider.js 4.41 kB 0 B
packages/openfeature-web-provider/dist/provider.mjs 3.06 kB 0 B
packages/plugin-utils/dist/cli.js 3.14 kB 0 B
packages/plugin-utils/dist/cli.mjs 1.64 kB 0 B
packages/plugin-utils/dist/config.js 3.07 kB 0 B
packages/plugin-utils/dist/config.mjs 1.83 kB 0 B
packages/plugin-utils/dist/index.js 4.3 kB 0 B
packages/plugin-utils/dist/index.mjs 217 B 0 B
packages/plugin-utils/dist/spawn-local.js 2.17 kB 0 B
packages/plugin-utils/dist/spawn-local.mjs 918 B 0 B
packages/plugin-utils/dist/utils.js 3.27 kB 0 B
packages/plugin-utils/dist/utils.mjs 1.3 kB 0 B
packages/react-native/dist/autocapture.js 6.27 kB 0 B
packages/react-native/dist/error-tracking/index.js 9.97 kB 0 B
packages/react-native/dist/error-tracking/utils.js 2.58 kB 0 B
packages/react-native/dist/frameworks/wix-navigation.js 1.3 kB 0 B
packages/react-native/dist/hooks/useFeatureFlag.js 1.84 kB 0 B
packages/react-native/dist/hooks/useFeatureFlagResult.js 963 B 0 B
packages/react-native/dist/hooks/useFeatureFlags.js 921 B 0 B
packages/react-native/dist/hooks/useNavigationTracker.js 2.45 kB 0 B
packages/react-native/dist/hooks/usePostHog.js 544 B 0 B
packages/react-native/dist/hooks/utils.js 988 B 0 B
packages/react-native/dist/index.js 4.33 kB 0 B
packages/react-native/dist/logs-********.js 3.66 kB 0 B
packages/react-native/dist/native-deps.js 8.73 kB 0 B
packages/react-native/dist/optional/OptionalAsyncStorage.js 299 B 0 B
packages/react-native/dist/optional/OptionalExpoApplication.js 377 B 0 B
packages/react-native/dist/optional/OptionalExpoDevice.js 347 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystem.js 386 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystemLegacy.js 423 B 0 B
packages/react-native/dist/optional/OptionalExpoLocalization.js 383 B 0 B
packages/react-native/dist/optional/OptionalPlugin.js 569 B 0 B
packages/react-native/dist/optional/OptionalReactNativeDeviceInfo.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeLocalize.js 303 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigation.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigationWix.js 443 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSafeArea.js 644 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSvg.js 872 B 0 B
packages/react-native/dist/posthog-rn.js 55 kB 0 B
packages/react-native/dist/PostHogContext.js 329 B 0 B
packages/react-native/dist/PostHogErrorBoundary.js 3.19 kB 0 B
packages/react-native/dist/PostHogMaskView.js 1.68 kB 0 B
packages/react-native/dist/PostHogProvider.js 4.55 kB 0 B
packages/react-native/dist/storage.js 5.76 kB 0 B
packages/react-native/dist/surveys/components/BottomSection.js 1.51 kB 0 B
packages/react-native/dist/surveys/components/Cancel.js 968 B 0 B
packages/react-native/dist/surveys/components/ConfirmationMessage.js 1.71 kB 0 B
packages/react-native/dist/surveys/components/QuestionHeader.js 1.43 kB 0 B
packages/react-native/dist/surveys/components/QuestionTypes.js 14 kB 0 B
packages/react-native/dist/surveys/components/SurveyModal.js 6.59 kB 0 B
packages/react-native/dist/surveys/components/Surveys.js 6.58 kB 0 B
packages/react-native/dist/surveys/getActiveMatchingSurveys.js 2.64 kB 0 B
packages/react-native/dist/surveys/icons.js 10 kB 0 B
packages/react-native/dist/surveys/index.js 600 B 0 B
packages/react-native/dist/surveys/PostHogSurveyProvider.js 6.28 kB 0 B
packages/react-native/dist/surveys/safeStyleSheet.js 448 B 0 B
packages/react-native/dist/surveys/survey-translations.js 1.11 kB 0 B
packages/react-native/dist/surveys/surveys-utils.js 14.2 kB 0 B
packages/react-native/dist/surveys/useActivatedSurveys.js 3.67 kB 0 B
packages/react-native/dist/surveys/useSurveyStorage.js 2.16 kB 0 B
packages/react-native/dist/tooling/expoconfig.js 11.9 kB 0 B
packages/react-native/dist/tooling/metroconfig.js 2.32 kB 0 B
packages/react-native/dist/tooling/posthogMetroSerializer.js 4.86 kB 0 B
packages/react-native/dist/tooling/utils.js 4.05 kB 0 B
packages/react-native/dist/tooling/vendor/expo/expoconfig.js 70 B 0 B
packages/react-native/dist/tooling/vendor/metro/countLines.js 237 B 0 B
packages/react-native/dist/tooling/vendor/metro/utils.js 3.35 kB 0 B
packages/react-native/dist/types.js 70 B 0 B
packages/react-native/dist/utils.js 1.3 kB 0 B
packages/react-native/dist/version.js 130 B 0 B
packages/react/dist/esm/index.js 21.1 kB 0 B
packages/react/dist/esm/slim/index.js 17.5 kB 0 B
packages/react/dist/esm/surveys/index.js 4.68 kB 0 B
packages/react/dist/umd/index.js 24.4 kB 0 B
packages/react/dist/umd/slim/index.js 20.3 kB 0 B
packages/react/dist/umd/surveys/index.js 5.45 kB 0 B
packages/rollup-plugin/dist/index.js 2.44 kB 0 B
packages/rrweb/all/dist/rrweb-all.cjs 633 kB 0 B
packages/rrweb/all/dist/rrweb-all.js 633 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.cjs 636 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.min.cjs 299 kB 0 B
packages/rrweb/packer/dist/base-********.js 18.2 kB 0 B
packages/rrweb/packer/dist/base-********.cjs 18.3 kB 0 B
packages/rrweb/packer/dist/base-********.umd.cjs 18.7 kB 0 B
packages/rrweb/packer/dist/base-********.umd.min.cjs 9.5 kB 0 B
packages/rrweb/packer/dist/pack.cjs 347 B 0 B
packages/rrweb/packer/dist/pack.js 285 B 0 B
packages/rrweb/packer/dist/pack.umd.cjs 1.63 kB 0 B
packages/rrweb/packer/dist/pack.umd.min.cjs 1.11 kB 0 B
packages/rrweb/packer/dist/packer.cjs 257 B 0 B
packages/rrweb/packer/dist/packer.js 136 B 0 B
packages/rrweb/packer/dist/packer.umd.cjs 662 B 0 B
packages/rrweb/packer/dist/packer.umd.min.cjs 626 B 0 B
packages/rrweb/packer/dist/unpack.cjs 769 B 0 B
packages/rrweb/packer/dist/unpack.js 702 B 0 B
packages/rrweb/packer/dist/unpack.umd.cjs 1.17 kB 0 B
packages/rrweb/packer/dist/unpack.umd.min.cjs 955 B 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.cjs 37.6 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.js 37.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.cjs 38 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.min.cjs 22.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.cjs 34.3 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.js 34.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.cjs 34.7 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.min.cjs 20.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.cjs 14.9 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js 14.8 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.cjs 15.4 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.min.cjs 7.33 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.cjs 5.01 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.js 4.9 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.cjs 5.44 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.min.cjs 2.64 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.cjs 681 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.js 548 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.cjs 1.12 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.min.cjs 829 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.cjs 933 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.js 820 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.cjs 1.37 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.min.cjs 968 B 0 B
packages/rrweb/record/dist/rrweb-record.cjs 187 kB 0 B
packages/rrweb/record/dist/rrweb-record.js 187 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.cjs 187 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.min.cjs 89 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.cjs 448 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.js 448 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.cjs 451 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.min.cjs 213 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.cjs 153 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.js 152 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.cjs 154 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.min.cjs 71.7 kB 0 B
packages/rrweb/rrdom/dist/rrdom.cjs 177 kB 0 B
packages/rrweb/rrdom/dist/rrdom.js 176 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.cjs 178 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.min.cjs 81.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.cjs 34.5 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.js 33.4 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.cjs 55.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.min.cjs 26.4 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.cjs 141 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.js 140 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.cjs 163 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.min.cjs 75 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.cjs 2.27 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.js 1.42 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.cjs 223 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.min.cjs 93.6 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.cjs 18.3 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.cjs 18.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.min.cjs 9.31 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.js 17.8 kB 0 B
packages/rrweb/rrweb/dist/rrweb.cjs 617 kB 0 B
packages/rrweb/rrweb/dist/rrweb.js 617 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.cjs 617 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.min.cjs 289 kB 0 B
packages/rrweb/types/dist/rrweb-types.cjs 5.75 kB 0 B
packages/rrweb/types/dist/rrweb-types.js 5.46 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.cjs 6.16 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.min.cjs 2.86 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.cjs 6.41 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.js 5.95 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.cjs 6.82 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.min.cjs 3.51 kB 0 B
packages/types/dist/capture-log.js 603 B 0 B
packages/types/dist/capture-log.mjs 0 B 0 B 🆕
packages/types/dist/capture.js 603 B 0 B
packages/types/dist/capture.mjs 0 B 0 B 🆕
packages/types/dist/common.js 603 B 0 B
packages/types/dist/common.mjs 0 B 0 B 🆕
packages/types/dist/feature-flags.js 603 B 0 B
packages/types/dist/feature-flags.mjs 0 B 0 B 🆕
packages/types/dist/index.js 603 B 0 B
packages/types/dist/index.mjs 0 B 0 B 🆕
packages/types/dist/posthog-config.js 603 B 0 B
packages/types/dist/posthog-config.mjs 0 B 0 B 🆕
packages/types/dist/posthog.js 603 B 0 B
packages/types/dist/posthog.mjs 0 B 0 B 🆕
packages/types/dist/request.js 603 B 0 B
packages/types/dist/request.mjs 0 B 0 B 🆕
packages/types/dist/segment.js 603 B 0 B
packages/types/dist/segment.mjs 0 B 0 B 🆕
packages/types/dist/session-recording.js 603 B 0 B
packages/types/dist/session-recording.mjs 0 B 0 B 🆕
packages/types/dist/survey.js 603 B 0 B
packages/types/dist/survey.mjs 0 B 0 B 🆕
packages/types/dist/toolbar.js 603 B 0 B
packages/types/dist/toolbar.mjs 0 B 0 B 🆕
packages/types/dist/tree-shakeable.js 603 B 0 B
packages/types/dist/tree-shakeable.mjs 0 B 0 B 🆕
packages/web/dist/index.cjs 14.1 kB 0 B
packages/web/dist/index.mjs 14 kB 0 B
packages/webpack-plugin/dist/config.js 1.47 kB 0 B
packages/webpack-plugin/dist/config.mjs 480 B 0 B
packages/webpack-plugin/dist/index.js 6.7 kB 0 B
packages/webpack-plugin/dist/index.mjs 2.94 kB 0 B
tooling/changelog/dist/index.js 3.31 kB 0 B
tooling/rollup-utils/dist/index.js 1.17 kB 0 B

compressed-size-action

…sent events

Two changes for events at risk of loss on page unload:

- the reference snippet (new canonical copy at packages/browser/snippet/snippet.js)
  gains a pagehide fallback: if array.js has not loaded yet, queued capture calls
  are sent via sendBeacon to /e/ marked $sent_by_snippet_fallback_on_unload, and
  spliced from the queue on successful hand-off so a late array.js drain can
  never double-process them. Consent/DNT/cookieless/disable_beacon all skip.
  The loader script is now appended to head instead of inserted before the
  first script element, so the snippet works in script-less documents too.
- the SDK's sendBeacon transport now tags /e/ payloads with $sent_send_beacon
  so fire-and-forget deliveries are identifiable in analysis.

A jest size test guards the snippet byte budget (currently 2944 B minified /
1529 B gzipped) and jsdom + playwright suites cover payload shape, identity
resolution, consent gating, and the dedupe race against the real drain.

The production snippet lives in posthog/posthog; grafting this fallback onto
it is a follow-up PR there.

Generated-By: PostHog Code
Task-Id: 5b4a3349-ee3e-4280-9742-b1584372e9ba
…in block

The fallback is deliberately not part of the default snippet: it adds ~1.3KB
gzipped to every page's HTML and trades away correctness guarantees (identity
joining, pipeline hooks) that only make sense for sites measurably losing
events to bounces. snippet/unload-fallback.js is self-contained - paste it in
any order near the snippet, twice is harmless - so it can be shared with the
particular customers who need it. snippet/snippet.js reverts to loader-only.

Hardenings over the previous embedded version:
- a queued opt_out_capturing/opt_in_capturing is respected, last call wins,
  mirroring the real drain's replay order
- sites customizing the event pipeline (before_send, sanitize_properties,
  property_blacklist/denylist, request_headers, queued set_config) are
  skipped entirely - bypassing redaction is worse than losing events
- bot traffic is skipped (navigator.webdriver or bot/headless user agents),
  honoring opt_out_useragent_filter like the SDK
- payloads are bounded: at most 50 events, and oversized bodies are left
  queued rather than rejected by the 64KB beacon limit

snippet/README.md documents installation, guarantees, and caveats for
sharing. New jsdom tests prove the opt-in property in both directions, the
queued-consent semantics, and the payload bounds.

Generated-By: PostHog Code
Task-Id: 5b4a3349-ee3e-4280-9742-b1584372e9ba
@pauldambra
pauldambra force-pushed the posthog-code/snippet-unload-beacon-fallback branch from 63403ce to fff4e09 Compare July 8, 2026 17:16

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

The file is source customers audit before pasting - terser does the
shrinking, so golfed helper names and one monolithic handler optimized
the wrong thing. The logic is now decomposed into named functions
(visitorHasOptedOut, resolveIdentity, collectQueuedCaptures, ...) with
descriptive variables, still ES5 and behavior-identical: the jsdom suite
executes the file verbatim and the minified-parity test covers the
terser output.

Legibility costs 448 B minified (2962 B / 1455 B gz, budget raised to
3300/1600) - the right trade for an example file.

Generated-By: PostHog Code
Task-Id: 5b4a3349-ee3e-4280-9742-b1584372e9ba
# Conflicts:
#	packages/browser/src/request.ts
@pauldambra

Copy link
Copy Markdown
Member Author

this isn't it

@pauldambra pauldambra closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant