Mobile Session Replay Setup and Configuration

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

セットアップ

セッションリプレイ SDK は、Maven スナップショットリポジトリにすべてのバージョンが用意されています。

Android 用にモバイルセッションリプレイを設定する方法

  1. Datadog Android RUM SDK の設定と初期化が完了し、ビューインスツルメンテーションが有効になっていることを確認します。

  2. Datadog セッションリプレイを依存関係として宣言します。

build.gradle

    implementation("com.datadoghq:dd-sdk-android-rum:[datadog_version]")
    implementation("com.datadoghq:dd-sdk-android-session-replay:[datadog_version]")
    //  Material UI のサポートが必要な場合
    implementation("com.datadoghq:dd-sdk-android-session-replay-material:[datadog_version]")
   
  1. アプリでセッションリプレイを有効にします。

Application.kt

   val sessionReplayConfig = SessionReplayConfiguration.Builder([sampleRate])
    // Material UI の拡張サポートが必要な場合
    .addExtensionSupport(MaterialExtensionSupport()) 
    .build()
   SessionReplay.enable(sessionReplayConfig)
   

iOS 用にモバイルセッションリプレイを設定する方法

  1. Datadog iOS RUM SDK の設定と初期化が完了し、ビューインスツルメンテーションが有効になっていることを確認します。

  2. パッケージマネージャーに応じて、Datadog セッションリプレイライブラリをプロジェクトに接続します。

    パッケージマネージャーインストール手順
    CocoaPodspod 'DatadogSessionReplay'Podfile に追加します。
    Swift Package ManagerDatadogSessionReplay ライブラリを依存関係としてアプリターゲットに追加します。
    CarthageDatadogSessionReplay.xcframework を依存関係としてアプリターゲットに追加します。
  3. アプリでセッションリプレイを有効にします。

AppDelegate.swift

   import DatadogSessionReplay

   SessionReplay.enable(
       with: SessionReplay.Configuration(
           replaySampleRate: sampleRate
       )
   )
   

Web view instrumentation

You can record the entire user journey across both web and native views on iOS or Android and watch it in a single Session Replay.

The Session Replay is recorded through the Browser SDK, then the Mobile SDK handles the batching and uploading of the webview recording.

To instrument your consolidated web and native Session Replay views for Android:

  1. Ensure you are using version 2.8.0 or higher of the Android SDK.
  2. Enable webview tracking for your mobile application.
  3. Enable Session Replay for your web application.
  4. Enable Session Replay for your mobile application (see setup instructions above).

To instrument your consolidated web and native Session Replay views for iOS:

  1. Ensure you are using version 2.13.0 or higher of the iOS SDK.
  2. Enable webview tracking for your mobile application.
  3. Enable Session Replay for your web application.
  4. Enable Session Replay for your mobile application (see setup instructions above).

追加構成

記録したセッションが表示されるサンプルレートの設定

Sample rate is a required parameter in Session Replay configuration. It must be a number between 0.0 and 100.0, where 0 means no replays are recorded and 100 means all RUM sessions contain replay.

This sample rate is applied in addition to the RUM sample rate. For example, if RUM uses a sample rate of 80% and Session Replay uses a sample rate of 20%, it means that out of all user sessions, 80% are included in RUM, and within those sessions, only 20% have replays.

Application.kt

val sessionReplayConfig = SessionReplayConfiguration.Builder([sampleRate])
 ...
.build()

AppDelegate.swift

var sessionReplayConfig = SessionReplay.Configuration(
    replaySampleRate: sampleRate
)

セッションリプレイデータが送信されているかどうかの検証

セッションリプレイデータがアプリから送信されているかどうかを検証するには、Datadog SDK でデバッグオプションを有効にします。

Application.kt

Datadog.setVerbosity(Log.DEBUG)

AppDelegate.swift

Datadog.verbosityLevel = .debug

設定がすべて正しく行われていれば、アプリが起動してから約 30 秒後に、以下のログが Xcode デバッグコンソールに表示されるはずです。

Xcode console

[DATADOG SDK] 🐶 → 10:21:29.812 ⏳ (session-replay) Uploading batch...
[DATADOG SDK] 🐶 → 10:21:30.442    → (session-replay) accepted, won't be retransmitted: [response code: 202 (accepted), request ID: BD445EA-...-8AFCD3F3D16]

プライバシーのオプション

プライバシーオプションをご覧ください。

参考資料