mcpField
E
error-tracking-web

error-tracking-web

github.com/posthogDevelopment76116 installsUpdated today
Repository

About error-tracking-web

A skill for adding PostHog error tracking to JavaScript web applications. It covers SDK setup, source maps, issue monitoring, and safe event handling while preserving existing error handling.

Key features

  1. 01Configure posthog-js error tracking
  2. 02Enable exception autocapture
  3. 03Upload source maps
  4. 04Capture boundary errors manually
  5. 05Monitor and assign issues

Use cases

  1. 01Add error tracking to a web app
  2. 02Improve stack traces with source maps
  3. 03Capture errors missed by global handlers

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/posthog/skills --skill error-tracking-web

After installing, type/error-tracking-webin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
alerts.md
assigning-issues.md
fingerprints.md
monitoring.md
upload-source-maps.md
web.md

Details

From the project README

PostHog error tracking for Web (JavaScript)

This skill helps you add PostHog error tracking to Web (JavaScript) applications.

Reference files

  • references/web.md - Web error tracking installation - docs
  • references/fingerprints.md - Fingerprints - docs
  • references/alerts.md - Send error tracking alerts - docs
  • references/monitoring.md - Monitor and search issues - docs
  • references/assigning-issues.md - Assign issues to teammates - docs
  • references/upload-source-maps.md - Upload source maps - docs

Consult the documentation for API details and framework-specific patterns.

Key principles

  • Environment variables: Always use environment variables for PostHog keys and host URLs. Never hardcode them.
  • Minimal changes: Add error tracking alongside existing error handling. Don't replace or restructure existing error handling code.
  • Autocapture first: Enable exception autocapture in the SDK initialization before adding manual captures.
  • Source maps: Upload source maps so stack traces resolve to original source code, not minified bundles.
  • Manual capture for boundaries: Use captureException() at error boundaries and catch blocks for errors that don't propagate to the global handler.

Framework guidelines

  • Remember that source code is available in the node_modules directory
  • Check package.json for type checking or build scripts to validate changes
  • posthog-js is the JavaScript SDK package name
  • posthog.init() MUST be called before any other PostHog methods (capture, identify, etc.)
  • posthog-js is browser-only — do NOT import it in Node.js or server-side contexts (use posthog-node instead)
  • Autocapture is ON by default with posthog-js (tracks clicks, form submissions, pageviews). Do NOT disable autocapture unless the user explicitly requests it.
  • NEVER send PII in posthog.capture() event properties — no emails, full names, phone numbers, physical addresses, IP addresses, or user-generated content
  • PII belongs in posthog.identify() person properties (email, name, role), NOT in capture() event properties
  • Call posthog.identify(userId, { email, name, role }) on login AND on page refresh if the user is already logged in
  • Call posthog.reset() on logout to unlink future events from the current user
  • For SPAs without a framework router, capture pageviews with posthog.capture($pageview) or use the capture_pageview history_change option in init for History API routing

Comments

Markdown supported