Last updated:

|Edit this page

Why does this exist?

Our Sentry integration is a two-way integration which works on Javascript & Python. Once installed, it will:

  • Add a direct link in Sentry to the profile of the person affected in PostHog.
  • Send an $exception event to PostHog with a direct link to Sentry.

This way, debugging issues becomes a lot easier, and you can also correlate error data with your product metrics.

If you're looking for the PostHog + Sentry integration for Python, please check out the Python docs.


Make sure you're using both PostHog and Sentry as JS modules. You'll need to replace 'your organization' and project-id with the organization and project-id from Sentry.

  • 'your organization': will be in the URL when you go to your Sentry instance, like so:
  • project-id: will be the last few digits in your Sentry DSN, such as
  • prefix: Optional: Url of a self-hosted sentry instance (default:
  • severityAllowList: Optional: by default this is ['error'], you can provide more Sentry severity levels (e.g. ['error', 'info']) or '*' to capture any severity. Only available from posthog-js version 1.118.0 forward
import posthog from 'posthog-js'
import * as Sentry from '@sentry/browser'
dsn: '<your Sentry DSN>',
integrations: [new posthog.SentryIntegration(
'your organization',
undefined, // optional: but necessary if you want to set a severity allowlist
['error', 'info'] // optional: here is set to handle captureMessage (info) and captureException (error)


In PostHog, you'll now have $exception events, which have a "Sentry URL" link to take you to the exception:

Sentry exception event in PostHog

From Sentry you will now be able to go directly to the affected person in PostHog and watch the session recording for when the exception happened, see what else the user has done, and find their details. Don't forget to click the little icon to the side of the URL, not the URL itself.

PostHog user profile URL in Sentry


Was this page useful?