Getting started with error tracking

Capture your first exception

To get started with error tracking, the first step is to install the PostHog SDK to start capturing exception events within your application.

Platforms

Auto and manual capture

Exception autocapture can be enabled for most platforms. When enabled, PostHog automatically captures $exception events whenever errors are thrown by the client or server application.

You can also call the capture method posthog.captureException() to manually send exceptions to PostHog with custom properties.

Install PostHog SDK

Get accurate stack traces

The second step is to upload source maps to get accurate, readable stack traces for your captured exceptions. This helps you quickly identify and debug issues by showing you the original code context where the error occurred.

Stack traces example
Upload source maps

Monitor and resolve issues

Once you're capturing errors, the next step is to stay on top of issues. Exception events are grouped into issues for your team to manage based on event information, such as the exception type, message, and stack trace.

Error tracking overview

Use the PostHog error tracking dashboard to:

  • Manage, resolve, and auto-assign issues to team members
  • Customize issue grouping with rules
  • Set up real-time alerts based on event triggers, filters, and trends
  • Integrate with Slack, Discord, Teams, or an HTTP webhook
Learn about issues

Debug with AI

Let AI investigate and debug errors for you.

Connect with the PostHog MCP server to enable autonomous debugging with AI agents. You can also copy our premade AI prompts which include full stack traces and curated instructions for the AI to follow.

Explore AI features

Integrate customer data

Take advantage of PostHog's customer infrastructure features to help you move from application errors to product improvements.

Session replay

See exactly what users did before and after the error with session replays.

Product analytics

Use $exception events with product analytics to create trends, funnels, or retention insights to spot patterns and prioritize issues. You can also see exceptions by individual users in their event history log.

Product analytics dashboards

Feature flags

Roll out or revert code updates with feature flags based on users who’ve hit specific exceptions.

Feature flags taregting error cohorts

That's it! You're ready to start integrating.

Install error tracking

Community questions

Was this page useful?

Questions about this page? or post a community question.