iOS SESSION REPLAY¶
Prerequisites¶
- Ensure you have set up and initialized the FTMobileSDK RUM configuration, and enabled View monitoring.
- 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. 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 inputsFTSRPrivacyMaskUserInput : 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 touchesFTTouchPrivacyLevelHide : Masks all user touchesOverrides the privacy settingSupported 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 inputsFTTextAndInputPrivacyLevelMaskAllInputs : Masks all input fields, such as UITextField , UISwitch , UISlider , etc.FTTextAndInputPrivacyLevelMaskAll : Masks all text and inputsOverrides the privacy settingSupported 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;
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
.
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.