React Native error tracking installation
Install the PostHog React Native library and its dependencies: PostHog is most easily used via the Once installed, PostHog will automatically start capturing events. You can also manually send events using the This configuration is client-side only. Support for remote configuration in the error tracking settings will be added in a future release. You can autocapture exceptions by configuring the Configuration options: You can use the If you have both In development mode, React propagates all errors to the global error handler even when they are caught by an error boundary. This means you may see errors reported twice in dev builds. This is expected React behavior and does not occur in production builds. You can manually capture exceptions using the This is helpful if you've built your own error handling logic or want to capture exceptions that are handled by your application code. We currently don't support the following features: These features will be added in future releases. We recommend you stay up to date with the latest version of the PostHog React Native SDK.Install the package
RequiredConfigure PostHog
RequiredPostHogProvider component. Wrap your app with the provider:Send events
RecommendedusePostHog hook:Set up exception autocapture
RecommendederrorTracking when setting up PostHog:Option Description uncaughtExceptionsCaptures Uncaught exceptions ( ReactNativeGlobal.ErrorUtils.setGlobalHandler)unhandledRejectionsCaptures Unhandled rejections ( ReactNativeGlobal.onunhandledrejection)consoleCaptures console logs as errors according to the reported LogLevelSet up error boundaries
OptionalPostHogErrorBoundary component to capture rendering errors thrown by components:PostHogErrorBoundary and console capture enabled in your errorTracking config, render errors will be captured twice. This is because React logs all errors to the console by default. To avoid this, set console: [] on errorTracking.autocapture (for example, errorTracking: { autocapture: { console: [] } }) when using PostHogErrorBoundary.Manually capture exceptions
OptionalcaptureException method:Future features
Optional

