error-tracking-react

Automate PostHog error tracking integration into React applications.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill error-tracking-react
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-tracking-react
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/all/skills/error-tracking-react
Command: npx skills add https://github.com/PostHog/skills --skill error-tracking-react

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Capturing and tracking errors in React apps can be verbose and brittle without proper instrumentation. This skill provides a guided path to integrate PostHog error tracking into React, enabling automatic error capture, alerts, and diagnosable insights directly in your frontend.

Core Features & Use Cases

  • Automatic error capture: Enable exception autocapture across the React app with minimal changes.
  • Source maps & debugging: Upload and use source maps to map stack traces to original source code.
  • Error boundaries and manual capture: Use React error boundaries and captureException for errors beyond global handling.
  • Guided best practices: Environment-variable usage for tokens/hosts and framework guidelines for capturing errors in event handlers.
  • Use Case: Instrument a React app to monitor client-side errors, alert on critical issues, and link to PostHog issues for triage.

Quick Start

Install and configure PostHog for React, enable exception autocapture, and verify events appear in the activity feed.

Frequently Asked Questions about error-tracking-react

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up error tracking in React with PostHog?

PostHog error tracking in React uses exception autocapture to automatically monitor client-side errors. You install posthog-js and @posthog/react, configure environment variables for the api_host and project token, and enable automatic exception capture across your application.

What are React error boundaries and when do I need them for error tracking?

React error boundaries catch errors in component trees to prevent full app crashes. You need them alongside exception autocapture to manually capture exceptions for component-level errors that bypass global handling, ensuring comprehensive frontend error tracking coverage.

How do I map minified stack traces to original source code in React error tracking?

You map minified stack traces by uploading and configuring source maps in PostHog. This translates production stack traces back to your original React source code, making debugging and diagnosing frontend errors significantly easier.

Can I capture React event handler errors automatically with PostHog?

PostHog captures errors automatically through exception autocapture, but errors in React event handlers often require following specific framework guidelines for manual captureException calls to ensure they appear in your activity feed.

Do I need environment variables to configure PostHog in a React app?

Yes, you need environment variables to securely configure the PostHog api_host and project token in your React app. This keeps sensitive keys out of hardcoded strings and follows recommended error-tracking best practices.

Why are my PostHog exceptions not showing up in the activity feed?

Exceptions may not show up if exception autocapture is disabled, environment variables for the project token or api_host are misconfigured, or errors occur inside event handlers without manual captureException calls. Verify your PostHog libraries configuration and error boundary setup.