React Native Session Replay installation
Install with the wizard
Run this command in your project directory to add PostHog to your React Native project. The wizard detects your framework, installs the SDK, and sets up your first events.
Or set it up manually by following the rest of this guide.
- 1
Install the packages
RequiredInstall the PostHog React Native library, its dependencies, and the session replay plugin:
Plugin renamed in 4.47.0+@posthog/react-native-plugin(>= 2.0.1) is the renamedposthog-react-native-session-replayplugin. It was renamed inposthog-react-native4.47.0+ and now also powers native error tracking. If you're on aposthog-react-nativeversion earlier than 4.47.0, installposthog-react-native-session-replayinstead. Don't install it alongside@posthog/react-native-plugin3.0: its pod still installsposthog-ios3.x, and the Xcode build fails withRedefinition of module 'PostHog'.@posthog/react-native-plugin3.0 needsposthog-react-native4.88.4 or later; with an older version, native session replay stays off.SDK versionSession replay requires PostHog React Native SDK version 3.2.0 or higher. We recommend always using the latest version.
- 2
Enable session recordings in project settings
RequiredGo to your PostHog Project Settings and enable Record user sessions. Session recordings will not work without this setting enabled.
- 3
Configure PostHog with session replay
RequiredAdd
enableSessionReplay: trueto your PostHog configuration. Here are all the available options:App.tsxFor more configuration options, see the React Native session replay docs.
RequirementsRequires React Native 0.75+, Android API 26+, iOS 15+, and Xcode 26+. On React Native 0.75 and 0.76, including Expo SDK 52, Android builds also need Kotlin 2.0 or later. Expo Go is not supported - use a development build. Session replay is only supported on Android and iOS platforms.
- 4
Watch session recordings
RecommendedVisit your site or app and interact with it for at least 10 seconds to generate a recording. Navigate between pages, click buttons, and fill out forms to capture meaningful interactions.
- 5
Next steps
RecommendedNow that you're recording sessions, continue with the resources below to learn what else Session Replay enables within the PostHog platform.
Resource Description Watching recordings How to find and watch session recordings Privacy controls How to mask sensitive data in recordings Network recording How to capture network requests in recordings Console log recording How to capture console logs in recordings More tutorials Other real-world examples and use cases
iOS dependency resolution
CocoaPods is becoming read-only. CocoaPods trunk becomes read-only on December 2, 2026, and
posthog-ios4.0 and later is only published through Swift Package Manager (SPM).
@posthog/react-native-plugin3.0 and later always resolvesposthog-iosthrough SPM, including on the CocoaPods path, so upgrading the plugin is enough. See Upgrading to@posthog/react-native-plugin3.0.Plugin 2.x stays on
posthog-ios3.x on every iOS dependency path, including the hybrid and full SPM setups, so switching paths doesn't bring newer iOS SDK versions. To getposthog-ios4.0 and later, upgrade to plugin 3.0.This change doesn't affect
@posthog/react-native-pluginreleases on npm or Android.
From @posthog/react-native-plugin 3.0, posthog-ios always comes from Swift Package Manager. The plugin itself installs one of two ways:
- As a CocoaPods pod, the default for React Native and Expo apps.
pod installinstalls the plugin, and its podspec addsposthog-iosthrough Swift Package Manager. (Plugin 2.x resolvesposthog-iosfrom CocoaPods instead, or through Swift Package Manager with theposthog.useSpmproperty.) - React Native's experimental full Swift Package Manager integration, with no CocoaPods. PostHog verifies an iOS-only React Native 0.87.1 app with React Native Community CLI 20.2.0. This path requires
@posthog/react-native-plugin2.4.0 or later, Xcode 16 or later, and an iOS 15.1 or later app deployment target.
@posthog/react-native-plugin 3.0 and later requires React Native 0.75 or later and, on every path, Xcode 26 or later and an iOS 15 or later deployment target.
See iOS dependency paths for the native React Native plugin for the requirements and setup steps. This verification does not cover Expo or other React Native versions. Use CocoaPods (or, on @posthog/react-native-plugin 2.x, the hybrid path) unless you validate full Swift Package Manager for your configuration.
Troubleshooting
- If session replay looks janky or drops frames on high-refresh-rate (120Hz ProMotion) iPhones, set
sessionReplayConfig.iOSCaptureMethodto'gpu'(experimental, iOS only, requires@posthog/react-native-plugin3.0.0 andposthog-react-native4.89.0 or higher) to reduce main-thread work. Background screenshot capture was removed inposthog-ios4.0.0. On@posthog/react-native-plugin2.x withposthog-react-native4.45.0 or higher, the experimentalscreenshotModeBackgroundCapture: trueoption is still available, though it can trigger Xcode's Main Thread Checker warnings.





