Skip to main content
skill CX Codex

error-tracking-web — Claude Code skill: PostHog error tracking for web

error-tracking-web adds PostHog error tracking to a JavaScript web app: exception capture, source maps, alerts and issue triage, with the agent editing your code.

MIT 116 installs ★ 80 updated 2026-10-24

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add PostHog/skills --skill error-tracking-web -a claude-code
Open on GitHub

What error-tracking-web does

The skill steers an agent through wiring PostHog error reporting into a JavaScript front end. It ships six reference documents covering web installation, fingerprints, alerting, searching and monitoring issues, assigning issues to teammates, and uploading source maps. The agent opens the one it needs and works from there.

Keys stay out of the source: the project key and host URL belong in environment variables. Existing error handling stays put, with tracking layered next to it. Exception autocapture goes on at posthog.init() first; manual captureException() calls come afterwards, in error boundaries and catch blocks. Skip the source map upload and stack traces keep pointing at minified bundles, so that step matters.

posthog-js runs in the browser only, server code needs posthog-node. Call posthog.init() before anything else from the SDK. Keep personal data out of capture() event properties and hand it to posthog.identify() instead, on login and again on a page refresh; posthog.reset() on logout. Single-page apps without a router can record views with $pageview or the capture_pageview option set to history_change.

What it helps with

  • add exception capture to a JavaScript web app
  • get readable stack traces by uploading source maps
  • group repeated errors under one fingerprint
  • set up alerts when a new error shows up
  • hand an issue over to the right developer

Example prompts for the agent

  • Add PostHog error tracking to our React app, read the key from VITE_POSTHOG_KEY
  • Stack traces are coming back minified, walk me through the source map upload in references/upload-source-maps.md
  • Which errors in PostHog should I assign to the frontend team?

How to install error-tracking-web

1Skills CLI (Vercel)

npx skills add PostHog/skills --skill error-tracking-web -a claude-code

2Manually: put the files in place

~/.claude/skills/error-tracking-web/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/error-tracking-web/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about error-tracking-web

How do I install error-tracking-web in Claude Code?

Run npx skills add PostHog/skills --skill error-tracking-web -a claude-code. The skill lands at ~/.claude/skills/error-tracking-web/SKILL.md.

What does error-tracking-web do?

It guides an agent through adding PostHog error tracking to a web app: exception autocapture, manual captureException() at error boundaries, source map upload and alerts.

Do I need posthog-node as well?

Only for server-side code. posthog-js is browser-only and should not be imported in Node.

Source text

SKILL.md · MIT
---
name: error-tracking-web
description: PostHog error tracking for Web (JavaScript)
metadata:
  author: PostHog
  version: 1.9.4
---

# 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

© PostHog · MIT · PostHog/skills

Similar skills

All skills for Frontend and UI →

From the same set112

The whole set →
integration-javascript_node integration-javascript_node adds PostHog analytics to a server-side Node.js app with posthog-node: events in route handlers, user identification, exception tracking. CX Codex +1 131installs integration-javascript_web integration-javascript_web guides client-side PostHog setup in browser JavaScript apps using posthog-js. CX Codex +1 125installs llm-analytics-setup llm-analytics-setup adds PostHog LLM analytics to an app running on any supported provider, tracking tokens, latency and cost for every generation. CX Codex +1 120installs experiment-audit The experiment-audit Claude Code skill checks a PostHog experiment's setup, variant data, attribution, and metrics. It runs on requests to review or validate an A/B test. CX Codex +1 118installs monthly-to-annual The monthly-to-annual Claude Code skill evaluates a PostHog customer’s move from monthly billing to an annual prepaid credit plan. It produces a discount briefing and a plain-text Slack draft. CX Codex +1 115installs feature-flags-web The feature-flags-web skill helps add PostHog feature flags to JavaScript web apps. Use it for boolean checks, server-side evaluation, and flag management through MCP. CX Codex +1 114installs feature-flags-nodejs The feature-flags-nodejs skill helps add PostHog feature flags to Node.js applications. Use it when new behavior needs controlled server-side rollout. CX Codex +1 113installs integration-expo The integration-expo skill adds PostHog analytics to Expo apps and guides the setup in stages. Use it for events, user identification, screens, and errors. CX Codex +1 112installs

Project sponsors

Companies that keep this analytics open