iOS SESSION REPLAY¶
Prerequisites¶
- Ensure you have set up and initialized the FTMobileSDK RUM configuration, and enabled View monitoring collection.
- iOS Session Replay is currently an alpha feature, version support: SDK.Version >= 1.6.0
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];
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 inputsFTSRPrivacyMaskUserInput : 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 touchesFTTouchPrivacyLevelHide : Masks all user touchesOverrides privacy settings after being setSDK 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 inputsFTTextAndInputPrivacyLevelMaskAllInputs : Masks all input fields, such as UITextField , UISwitch , UISlider , etc.FTTextAndInputPrivacyLevelMaskAll : Masks all text and inputOverrides privacy settings after being setSDK 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;
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
.
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.