Skip to content

iOS SESSION REPLAY

Prerequisites

Configuration

Link the FTSessionReplay feature component from the FTMobileSDK library to your project according to your package manager:

Package Manager Installation Steps
CocoaPods Add pod 'FTMobileSDK/FTSessionReplay','latest_version' to your Podfile. You need to specify the SDK version number.
Swift Package Manager Add FTSessionReplay as a dependency for your app target.

Code Invocation

#import <FTMobileSDK/FTRumSessionReplay.h>

   FTSessionReplayConfig *srConfig = [[FTSessionReplayConfig alloc]init];
   srConfig.touchPrivacy = FTTouchPrivacyLevelShow;
   srConfig.textAndInputPrivacy = FTTextAndInputPrivacyLevelMaskSensitiveInputs;
   srConfig.sampleRate = 100;
   [[FTRumSessionReplay sharedInstance] startWithSessionReplayConfig:srConfig];
   let srConfig = FTSessionReplayConfig.init()
   srConfig.touchPrivacy = .show
   srConfig.textAndInputPrivacy = .maskSensitiveInputs
   srConfig.sampleRate = 100
   FTRumSessionReplay.shared().start(with: srConfig)
Property Type Required Meaning
sampleRate int No Sampling rate. Range [0,100], 0 means no sampling, 100 means full sampling, default value is 100. This sampling rate is based on the RUM sampling rate.
sessionReplayOnErrorSampleRate int No Set the error sampling rate. If the session is not sampled by sampleRate, but an error occurs during the session, data within the last one minute can be captured. Range [0,100], 0 means no sampling, 100 means full sampling, default value is 0. Supported in SDK 1.6.2-alpha.1 and above.
privacy FTSRPrivacy No Set the privacy level for content masking in Session Replay. Default is FTSRPrivacyMask.
Masking handling: text replaced with * or #
FTSRPrivacyAllow: Records all content except sensitive input controls, such as password inputs
FTSRPrivacyMaskUserInput: Masks input elements, such as UITextField, UISwitch, etc.
FTSRPrivacyMask: Masks all content.
Deprecated, can be used for compatibility, it is recommended to use touchPrivacy and textAndInputPrivacy for finer-grained privacy settings
touchPrivacy FTTouchPrivacyLevel No Available privacy levels for touch masking in session replay. Default is FTTouchPrivacyLevelHide.
FTTouchPrivacyLevelShow: Shows all user touches
FTTouchPrivacyLevelHide: Masks all user touches
Overrides the privacy setting
Supported in SDK 1.6.1 and above versions
textAndInputPrivacy FTTextAndInputPrivacyLevel No Available privacy levels for text and input masking in session replay. Default is FTTextAndInputPrivacyLevelMaskAll
FTTextAndInputPrivacyLevelMaskSensitiveInputs: Shows all text except sensitive inputs, such as password inputs
FTTextAndInputPrivacyLevelMaskAllInputs: Masks all input fields, such as UITextField, UISwitch, UISlider, etc.
FTTextAndInputPrivacyLevelMaskAll: Masks all text and inputs
Overrides the privacy setting
Supported in SDK 1.6.1 and above versions

Privacy Overrides

Supported in SDK 1.6.1 and above

In addition to supporting global masking level configurations 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 overrides, they should be applied as early as possible in the view lifecycle. This prevents the session replay from processing the view before the override is set.
  • Privacy overrides affect the view and its subviews. 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 subviews.
  • Priority of privacy overrides: Subview > Parent view > Global settings

Text and Input Overrides

To override text and input privacy, use sessionReplayOverrides.textAndInputPrivacy on the view instance and set it to one of the values in the FTTextAndInputPrivacyLevelOverride enumeration. To remove existing override rules, simply set this property to FTTextAndInputPrivacyLevelOverrideNone.

#import <FTMobileSDK/UIView+FTSRPrivacy.h>
   // Set text and input override for a specific view
   myView.sessionReplayPrivacyOverrides.textAndInputPrivacy = FTTextAndInputPrivacyLevelOverrideMaskAll;
   // Remove text and input override for the view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = FTTextAndInputPrivacyLevelOverrideNone;
   // Set text and input override for a specific view
   myView.sessionReplayPrivacyOverrides.textAndInputPrivacy = .maskAll
   // Remove text and input override for the view
   myView.sessionReplayPrivacyOverrides.textAndInputPrivacy = .none

Touch Overrides

To override touch privacy, use sessionReplayOverrides.touchPrivacy on the view instance and set it to one of the values in the FTTouchPrivacyLevelOverride enumeration. To remove existing override rules, simply set this property to FTTouchPrivacyLevelOverrideNone.

#import <FTMobileSDK/UIView+FTSRPrivacy.h>
   // Set touch override for a specific view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = FTTouchPrivacyLevelOverrideShow;
   // Remove touch override for the view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = FTTouchPrivacyLevelOverrideNone;
   // Set touch override for a specific view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = .show;
   // Remove touch override for the view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = .none;

Hidden Element Overrides

For sensitive elements that need to be fully hidden, use sessionReplayPrivacyOverrides.hide to set them.

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

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

#import <FTMobileSDK/UIView+FTSRPrivacy.h>
   // Set hidden element override for a specific view
   myView.sessionReplayPrivacyOverrides.hide = YES;
   // Remove hidden element override for the view
   myView.sessionReplayPrivacyOverrides.hide = NO;
   // Set hidden element override for a specific view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = true;
   // Remove hidden element override for the view
   myView.sessionReplayPrivacyOverrides.touchPrivacy = false;

Code and Configuration Reference

Feedback

Is this page helpful? ×