Skip to content

Android SESSION REPLAY

Prerequisites

#ft-sdk alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-sdk/maven-metadata.xml | grep alpha

#ft-session-replay alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-session-replay/maven-metadata.xml | grep alpha

#ft-session-replay-material alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-session-replay-material/maven-metadata.xml | grep alpha

Configuration

//Add SDK dependencies
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:[latest_alpha_version]
//Enable session replay feature
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-session-replay:[latest_alpha_version]'
//Support for session replay requires material components
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-session-replay-material:[latest_alpha_version]'

Code Sample

FTSdk.initSessionReplayConfig(new FTSessionReplayConfig().setSampleRate(1f)
            .setPrivacy(SessionReplayPrivacy.ALLOW)
            .addExtensionSupport(new MaterialExtensionSupport()), context);
FTSdk.initSessionReplayConfig(FTSessionReplayConfig().setSampleRate(1f)
            .setPrivacy(SessionReplayPrivacy.ALLOW)
            .addExtensionSupport(MaterialExtensionSupport()), context)
Method Name Type Required Description
setSampleRate Float No Set the sampling rate, range [0,1], 0 means no sampling, 1 means full sampling, default is 1.
setSessionReplayOnErrorSampleRate Float No Set the error sampling rate. When a session is not sampled by setSampleRate, if an error occurs during the session, data from the 1 minute before the error can be sampled. Range [0,1], 0 means no sampling, 1 means full sampling, default is 0, supported in ft-session-replay 0.1.2-alpha01 and above.
setPrivacy SessionReplayPrivacy No SessionReplayPrivacy.ALLOW does not mask privacy data, SessionReplayPrivacy.MASK masks all data, including text, CheckBox, RadioButton, Switch; SessionReplayPrivacy.USER_INPUT (recommended) masks part of the user input data, including text in input boxes, CheckBox, RadioButton, Switch, default is SessionReplayPrivacy.MASK. Deprecated, can be used for compatibility, it is recommended to use setTouchPrivacy, setTextAndInputPrivacy for masking settings
setTextAndInputPrivacy TextAndInputPrivacy No TextAndInputPrivacy.MASK_SENSITIVE_INPUTS only masks sensitive information, TextAndInputPrivacy.MASK_ALL_INPUTS masks part of the user input data, including text in input boxes, CheckBox, RadioButton, Switch, TextAndInputPrivacy.MASK_ALL, masks all data, including text, CheckBox, RadioButton, Switch. Default is TextAndInputPrivacy.MASK_ALL, overrides setPrivacy configuration, supported in ft-session-replay 0.1.1-alpha01 and above.
setTouchPrivacy TouchPrivacy No TouchPrivacy.SHOW does not mask touch data, TouchPrivacy.HIDE masks touch data. Overrides setPrivacy configuration, supported in ft-session-replay 0.1.1-alpha01 and above.
addExtensionSupport ExtensionSupport No Add additional custom support. Using ft-session-replay-material allows MaterialExtensionSupport to provide additional Material component collection support.

Privacy Overrides

Supported in ft-session-replay 0.1.1-alpha01 and above.

In addition to supporting global masking levels through FTSessionReplayConfig, the SDK also supports overriding these settings at the view level.

View-level privacy overrides:

  • Supports overriding text and input masking levels and touch masking levels.
  • Supports setting specific views to be completely hidden.

Note:

  • To ensure correct recognition of override settings, they should be applied as early as possible in the view lifecycle. This prevents the Session Replay from processing the view before the override settings are applied.
  • Privacy overrides affect the view and its child views. This means that even if the override is applied to a view that may not take effect immediately (e.g., applying an image override to a text input), the override will still apply to all child views.
  • Privacy override priority: child view > parent view > global settings

Text and Input Overrides

To override text and input privacy, use PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(View,TextAndInputPrivacy) on the view instance to set it to one of the values in the TextAndInputPrivacy enum. To remove an existing override rule, simply set this property to null.

// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(view, TextAndInputPrivacy.MASK_ALL);
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(view, null);
// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(view, TextAndInputPrivacy.MASK_ALL)
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(view, null)

Touch Overrides

To override touch privacy, use PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(View,TouchPrivacy) on the view instance to set it to one of the values in the TouchPrivacy enum. To remove an existing override rule, simply set this property to null.

// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(view, TouchPrivacy.HIDE);
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(view, null);
// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(view, TouchPrivacy.HIDE)
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(view, null)

Hidden Element Overrides

For sensitive elements that need to be completely hidden, use PrivacyOverrideExtensions.setSessionReplayHidden(View,Boolean) to set them.

When an element is set to hidden, it will be replaced by a "Hidden" placeholder in the replay, and its child views will not be recorded.

Note: Marking a view as hidden does not prevent touch interactions on that element from being recorded. To hide touch interactions, in addition to marking the element as hidden, use Touch Overrides.

// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayHidden(view, true)
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayHidden(view, false)
// Mark a specific view for hidden element override
PrivacyOverrideExtensions.setSessionReplayHidden(view, true)
// Remove the hidden element override setting for the view
PrivacyOverrideExtensions.setSessionReplayHidden(view, false)

Jetpack Compose Support

Currently, Jetpack Compose related interfaces are not supported for Session Replay recording.

Code and Configuration References