Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ val config = PostHogAndroidConfig(apiKey = "<ph_project_token>").apply {
// Ps: it was 500ms (0.5s) by default until version 3.8.2
// Available from version 3.10.0 (Before it was called debouncerDelayMs)
sessionReplayConfig.throttleDelayMs = 1000

// Sample rate for session recordings. A value between 0.0 and 1.0.
// 1.0 means 100% of sessions will be recorded. 0.5 means 50%, and so on.
// Default is null (all sessions are recorded).
//
// Support for remote configuration
// in the session replay triggers (https://app.posthog.com/settings/project-replay#replay-triggers)
// requires SDK version 3.34.0 or higher.
sessionReplayConfig.sampleRate = null
}
```

Expand Down
9 changes: 9 additions & 0 deletions contents/docs/session-replay/_snippets/ios-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ config.sessionReplayConfig.screenshotMode = true
// A higher value reduces performance impact but decreases replay smoothness. Default is 1.0s.
// Note: Previously known as `debouncerDelay` before version 3.21.0
config.sessionReplayConfig.throttleDelay = 1.0

// Sample rate for session recordings. A value between 0.0 and 1.0.
// 1.0 means 100% of sessions will be recorded. 0.5 means 50%, and so on.
// Default is nil (all sessions are recorded).
//
// Support for remote configuration
// in the session replay triggers (https://app.posthog.com/settings/project-replay#replay-triggers)
// requires SDK version 3.42.0 or higher.
config.sessionReplayConfig.sampleRate = 0.5
```

## Limitations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,44 @@ This means:

> **Note:** Sampling reduces the number of sessions you record, but you cannot control which specific sessions are selected — the selection is determined by the session ID hash.

### Mobile SDK sampling

Sampling is also available in the Android and iOS SDKs. You can set a sample rate directly in your SDK configuration:

<Tab.Group tabs={['Android', 'iOS']}>
<Tab.List>
<Tab>Android</Tab>
<Tab>iOS</Tab>
</Tab.List>
<Tab.Panels>
<Tab.Panel>

```android_kotlin
val config = PostHogAndroidConfig(apiKey = "<ph_project_token>").apply {
sessionReplay = true
// Sample rate between 0.0 and 1.0. Default is null (all sessions recorded).
sessionReplayConfig.sampleRate = 0.5 // Record 50% of sessions
}
```

> **Note:** Requires Android SDK version 3.34.0 or higher. Remote configuration via [session replay triggers](https://app.posthog.com/settings/project-replay#replay-triggers) is also supported from this version.

</Tab.Panel>
<Tab.Panel>

```swift
let config = PostHogConfig(apiKey: "<ph_project_token>")
config.sessionReplay = true
// Sample rate between 0.0 and 1.0. Default is nil (all sessions recorded).
config.sessionReplayConfig.sampleRate = 0.5 // Record 50% of sessions
```

> **Note:** Requires iOS SDK version 3.42.0 or higher. Remote configuration via [session replay triggers](https://app.posthog.com/settings/project-replay#replay-triggers) is also supported from this version.

</Tab.Panel>
</Tab.Panels>
</Tab.Group>

## Combining controls

Since version 1.238.0 of the web SDK you can control how multiple triggers are combined. Choosing whether recording will start when all triggers match or when any trigger matches.
Expand Down