Skip to content

Windows Session Replay

Experimental Feature

Session Replay in the Windows SDK is disabled by default. It can be explicitly enabled and verified, but it is not yet in the stable release scope. Before integration, evaluate the compatibility, privacy, performance, and data volume of the target application on your own; do not treat the current behavior as a commitment to stable compatibility.

Supported Scopes

WPF, WinForms, WinUI 3, WebView2, Electron, and Native C/C++ applications can all be explicitly enabled and verified. The replay effect for different UI frameworks, cross-origin frames, Canvas, custom rendered content, and media playback controls must be individually verified in the target application.

Enabling Session Replay

Explicitly set SessionReplay.Enabled to true when initializing the SDK. The following example uses the public DataWay; when using a local deployment environment (DataKit), replace DatawayUrl and ClientToken with DatakitUrl.

using Guance.Windows;

GuanceSdk.Init(new GuanceConfig
{
    DatawayUrl = "https://openway.<your-domain>",
    ClientToken = "<client-token>",
    RumAppId = "<rum-app-id>",
    ServiceName = "desktop-client",
    Env = "prod",
    Version = "1.0.0",
    SessionReplay = new RumSessionReplayConfig
    {
        Enabled = true,
        SampleRate = 1.0,
        OnErrorSampleRate = 0.0,
        TextAndInputPrivacy = SessionReplayTextAndInputPrivacy.MaskAll,
        TouchPrivacy = SessionReplayTouchPrivacy.Show,
        ImagePrivacy = SessionReplayImagePrivacy.MaskAll
    }
});

For Native C/C++ applications, set the corresponding fields before initialization:

#include "guance_sdk.h"

guance_sdk_config config;
guance_sdk_config_init(&config);
config.session_replay_enabled = 1;
config.session_replay_sample_rate = 1.0;
config.session_replay_on_error_sample_rate = 0.0;

After filling in the required initialization fields such as DataWay or DataKit, RUM Application ID, Service Name, Environment, and Application Version, call guance_sdk_init(). The Native SDK also needs to register the replay window according to the window lifecycle; WebView2 and Electron page recordings are written to the same session via their respective Native Bridges.

Privacy Configuration

Session Replay may capture text, input, touch, and image information from the UI. Before enabling it, verify the captured content, data volume, and upload behavior in a test environment, and confirm that the global configuration and element-level overrides meet your business privacy requirements.

Attribute Type Required Description
TextAndInputPrivacy SessionReplayTextAndInputPrivacy No Sets the privacy level for text and input content. MaskSensitiveInputs only masks sensitive inputs; MaskAllInputs masks all input content; MaskAll masks all text and input content; Allow does not mask text and input content. Default: MaskAll.
TouchPrivacy SessionReplayTouchPrivacy No Sets the privacy level for pointer and touch actions. Show shows pointer and touch actions; Hide hides pointer and touch actions. Default: Show.
ImagePrivacy SessionReplayImagePrivacy No Sets the privacy level for image content. MaskAll masks all images; MaskLargeOnly masks only images whose rendered area exceeds a threshold; MaskNone does not actively mask images. Default: MaskAll.

It is recommended to use conservative strategies such as masking text, input, and images by default, and only relax the rules after completing a business evaluation. For accounts, payments, identity credentials, or other sensitive data, set stricter rules through element-level privacy overrides, or hide the entire element.

Privacy Override

In addition to global privacy levels configured via RumSessionReplayConfig, the SDK also supports overriding these settings at the view level. The following element-level APIs apply to .NET WPF, WinForms, and WinUI 3 controls.

View-level privacy overrides:

  • Supports overriding the privacy level for text and input, touch, and images
  • Supports completely hiding a specified element and its child elements

Notes:

  • Apply the override settings as early as possible in the element's lifecycle to ensure correct identification
  • Privacy overrides apply to the element and its child elements
  • Text, touch, and image privacy override priority: child element > parent element > global setting
  • The hide setting applies to the entire element tree; child elements cannot remove a hide setting inherited from a parent element

Text and Input Override

Use GuanceSdk.SetSessionReplayTextAndInputPrivacy() to set the text and input privacy level for an element. Pass null to remove the override setting for the current element.

// Set a text and input privacy override for the specified element
GuanceSdk.SetSessionReplayTextAndInputPrivacy(
    passwordBox,
    SessionReplayTextAndInputPrivacy.MaskAll);

// Remove the text and input privacy override for the specified element
GuanceSdk.SetSessionReplayTextAndInputPrivacy(passwordBox, null);

Touch Override

Use GuanceSdk.SetSessionReplayTouchPrivacy() to set the pointer and touch privacy level for an element. Pass null to remove the override setting for the current element.

// Hide the pointer and touch actions for the specified element
GuanceSdk.SetSessionReplayTouchPrivacy(
    paymentPanel,
    SessionReplayTouchPrivacy.Hide);

// Remove the pointer and touch privacy override for the specified element
GuanceSdk.SetSessionReplayTouchPrivacy(paymentPanel, null);

Image Override

Use GuanceSdk.SetSessionReplayImagePrivacy() to set the image privacy level for an element. Pass null to remove the override setting for the current element.

// Mask all images in the specified element
GuanceSdk.SetSessionReplayImagePrivacy(
    identityImage,
    SessionReplayImagePrivacy.MaskAll);

// Remove the image privacy override for the specified element
GuanceSdk.SetSessionReplayImagePrivacy(identityImage, null);

Hide Element Override

For sensitive elements that need to be completely hidden, use GuanceSdk.SetSessionReplayHidden(). After setting, the element is displayed as a Hidden placeholder in the replay, and child elements are not recorded.

// Hide the specified element and its child elements
GuanceSdk.SetSessionReplayHidden(customerIdentityPanel, true);

// Remove the hide setting for the specified element
GuanceSdk.SetSessionReplayHidden(customerIdentityPanel, false);

WebView2 and Electron

The Browser collector in WebView2 and Electron reads allow, mask-user-input, or mask from the native Bridge's getPrivacyLevel(). The privacy level must be determined by a trusted native configuration; the Renderer cannot relax it on its own.

Feedback

Is this page helpful?