Skip to main content

SDK configuration

The system can dynamically send some advanced configurations to the probe. Refer to the following for detailed configuration items and descriptions.

// Describes the configuration options provided externally
export type ReportConfigOptions = {
// Environment. Default: None
env?: string;
// Application version. Default: None
release?: string;
// Common configuration
common?: {
// Probe debug switch. Default: false
debug?: boolean;
// Session mode. Default: 'auto'
sessionMode?: 'auto' | 'manual';
// Force to specify the data protocol for sending. Default: None
sendProtocol?: string;
};
// Page monitoring configuration
page?: {
// Monitor route loading. Default: true
routerEnabled?: boolean;
// Specify the route mode to be monitored. Default: 'auto'
routerMode?: 'history' | 'hash' | 'auto';
// Default waiting time for route loading operations (in ms). Default: 500
routerOperationDelay?: number;
// Upload hash route switches without AJAX. Default: false
uploadNoAjaxHashRouter?: boolean;
// Default waiting time without AJAX during the page loading process (in ms). Default: 500
pageLoadDelay?: number;
// Whether to use LCP as the first screen. Default: true
lcpAsFs?: boolean;
// Whether to enable MutationObserver monitoring. Default: true
mutationEnabled?: boolean;
// When not using LCP to calculate the first screen, set the online image resources for the first screen. Default: None
fsResources?: string[];
};
// AJAX monitoring configuration
ajax?: {
// Overall switch for AJAX monitoring. Default: true
enabled?: boolean;
// Switch for AJAX XHR monitoring. Default: true
xhrEnabled?: boolean;
// Switch for AJAX Fetch monitoring. Default: true
fetchEnabled?: boolean;
// Switch for mPaaS monitoring. Default: true
mPaaSEnabled?: boolean;
// Monitor the setRequestHeader interface of XHR. Default: true
hookXhrSetRequestHeader?: boolean;
// Blacklist for AJAX requests. Default: None
ignoreUrls?: string[];
};
// JS error monitoring configuration
jsError?: {
// Whether to monitor JS errors. Default: true
enabled?: boolean;
// Whether to report JS errors with an empty file name. Default: false
uploadEmptyFileErrors?: boolean;
// Whether to use try-catch for asynchronous callback functions. Default: false
catchAsyncCallback?: boolean;
};
// Operation data
operation?: {
// Automatic monitoring switch for user operations. Default: true
enabled?: boolean;
// Whether to monitor callbacks bound to the onclick and onsubmit attributes of HTML tags. Default: true
inlineEventEnabled?: boolean;
// Whether to hook the onXXX (e.g., onclick, onsubmit) properties in HTMLElement.prototype. Default: true
onPropertyEnabled?: boolean;
// Whether to hook addEventListener/removeEventListener. Default: true
eventListenerEnabled?: boolean;
// Threshold (in ms) for associating an inline event with its subordinate requests. Default: 200
inlineEventThreshold?: number;
// Whether to enable automatic cross-page events. Default: true
crossPageEnabled?: boolean;
// Whitelist for elements such as AJAX and iframes under an operation. Default: None
itemUrls?: string[];
// Blacklist for elements such as AJAX and iframes under an operation. Default: None
ignoreItemUrls?: string[];
// Operation timeout (in ms). Default: 60000
timeout?: number;
// Threshold (in ms) for the time difference after an element is attached to an AJAX callback under an operation. Default: 100
resourceAssociationThreshold?: number;
// Maximum waiting time (in ms) for the loading of elements attached to an AJAX request under an operation. Default: 10000
resourceAssociationWaitTime?: number;
};
// APM configuration
requestTracing?: {
// Whether to actively add APM request headers. Default: false
autoAddApmHeader?: boolean;
};
// Element loading monitoring
resource?: {
// Whether to monitor iframe loading. Default: true
iframeEnabled?: boolean;
};
// Configuration refresh
configReload?: {
// Switch for getting configuration from the server. Default: true
enabled?: boolean;
// Duration (in minutes) for the configuration to expire. Default: 10
expire?: number;
};
// Web Vitals metric collection
webVitals?: {
// Overall switch. Default: true
enabled?: boolean;
// Switch for Web Vitals FID. Default: true
fidEnabled?: boolean;
// Switch for Web Vitals CLS. Default: true
clsEnabled?: boolean;
// Switch for Web Vitals TTI. Default: true
ttiEnabled?: boolean;
// Switch for Web Vitals TBT. Default: true
tbtEnabled?: boolean;
// Threshold for slow TTI. Default: 5000
ttiThreshold?: number;
};
// Video recording plugin configuration
replay?: {
// Privacy mode: 'standard' (Standard) / 'strict' (Strict). Default: 'standard'
privacyMode?: string;
// Configuration for masking elements
blockClass?: string[];
// Configuration for obfuscating text
maskTextClass?: string[];
// Configuration for ignoring input
ignoreClass?: string[];
};
}