Kotlin Multiplatform Session Replay installation
Install with the wizard
Run this command in your project directory to add PostHog to your Kotlin Multiplatform 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 dependency
RequiredAdd the PostHog KMP SDK to your shared module's
commonMainsource set:shared/build.gradle.kts0.+resolves to the latest0.xrelease. The SDK is a pre-release, so the API can change between minor versions – pin an exact version from Maven Central if you would rather upgrade deliberately.Supported targetsSession replay is captured on Android, iOS and the web. It is ignored on the JVM (desktop) target.
- 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
RequiredPass a
SessionRecordingConfigtoPostHogConfigfrom shared code. Here are all the available options:KotlinPass that config to
PostHog.setup(). Android needs theApplicationinstance, so it takesPostHogContext(application)– every other target takes the no-argumentPostHogContext().MyApplication.ktKotlinFor more configuration options, see the Kotlin Multiplatform session replay docs.
- 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





