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. Value range [0,100], 0 means no collection, 100 means full collection, default value is 100. This sampling rate is based on the RUM sampling rate.
privacy FTSRPrivacy No Set the privacy level for content masking in Session Replay. Default FTSRPrivacyMask.
Masking processing: Text replaced with * or #
FTSRPrivacyAllow: Records all content except sensitive input controls, such as password inputs
FTSRPrivacyMaskUserInput: Masks input elements. For example, UITextField, UISwitch, etc.
FTSRPrivacyMask: Masks all content.
Deprecated soon, can be used for compatibility, it's recommended to use touchPrivacy and textAndInputPrivacy for more granular privacy settings
touchPrivacy FTTouchPrivacyLevel No Available privacy levels for touch masking in session replay. Default FTTouchPrivacyLevelHide.
FTTouchPrivacyLevelShow: Shows all user touches
FTTouchPrivacyLevelHide: Masks all user touches
Overrides privacy settings after being set
SDK 1.6.1 and above supports this parameter
textAndInputPrivacy FTTextAndInputPrivacyLevel No Available privacy levels for text and input masking in session replay. Default 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 input
Overrides privacy settings after being set
SDK 1.6.1 and above supports this parameter

Privacy Overrides

Supported by SDK 1.6.1 and above

In addition to supporting global masking level configurations via 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 proper recognition of overrides, they should be applied as early as possible within the view lifecycle. This prevents session replay from processing views before the application’s overrides are 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 immediate effect (for example, 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, set it to one of the values in the FTTextAndInputPrivacyLevelOverride enumeration using sessionReplayOverrides.textAndInputPrivacy on the view instance. If you need to remove an existing override rule, simply set this property to FTTextAndInputPrivacyLevelOverrideNone.

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

Touch Overrides

To override touch privacy, set it to one of the values in the FTTouchPrivacyLevelOverride enumeration using sessionReplayOverrides.touchPrivacy on the view instance. If you need to remove an existing override rule, simply set this property to FTTouchPrivacyLevelOverrideNone.

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

Hidden Element Overrides

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

When an element is set to hidden, it will be replaced with a "Hidden" placeholder during 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, use touch overrides.

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

Code and Configuration References

Feedback

Is this page helpful? ×