Skip to content

fix: capture browser exceptions and drop in-app noise - #150

Merged
sonpiaz merged 1 commit into
mainfrom
fix/posthog-exceptions
Oct 2, 2026
Merged

sonpiaz merged 1 commit into
mainfrom
fix/posthog-exceptions

Conversation

@sonpiaz

@sonpiaz sonpiaz commented Oct 2, 2026

Copy link
Copy Markdown
Member

Why

Seven days of product analytics showed about 60,000 events and 2,300 users, and zero $exception events. The browser SDK was not capturing exceptions, so a broken page would not show up.

This turns capture_exceptions on. before_send drops noise before it is sent: Script error., Zalo's injected script, Facebook in-app postMessage failures, extension disconnects, and stacks whose every frame is the Facebook in-app browser or a browser extension. An exception that also has an app frame is kept.

No PostHog project setting is changed.

Test

npx tsx --test scripts/posthog-noise.test.ts — 5 passed.

The site recorded tens of thousands of events and zero exceptions. Turn exception capture on, and drop Script error, Zalo, Facebook in-app, and extension stacks before they are sent.
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
open-affiliate Ready Ready Preview Oct 2, 2026 5:39pm UTC

Request Review

@sonpiaz sonpiaz added the do-not-merge Emergency stop: never auto-merge this pull request label Oct 2, 2026
@github-actions github-actions Bot added the automerge:blocked Machine policy requires human review label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Auto-merge policy — LIVE

⛔ Blocked

  • blocking label: do-not-merge
  • changes more than 3 program files
  • sensitive or non-program path: .github/workflows/ci.yml
  • sensitive or non-program path: scripts/posthog-noise.test.ts
  • sensitive or non-program path: src/lib/posthog-noise.ts
  • sensitive or non-program path: src/lib/posthog.ts

Human review is required; auto-merge was not requested.

The workflow never executes pull-request code with its write token
and never falls back to a direct merge.

@sonpiaz
sonpiaz merged commit 55bdaad into main Oct 2, 2026
7 of 8 checks passed

This branch was successfully deployed

1 active deployment
Preview — ac3d92a0 Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge:blocked Machine policy requires human review do-not-merge Emergency stop: never auto-merge this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant