WebView Data Monitoring¶
App-side configuration¶
First complete SDK initialization and RUM configuration, then confirm the WebView collection switch and host configuration below.
WebView RUM collection is controlled by FTRUMConfig.enableTraceWebView in the RUM configuration, and defaults to true. WebView logs are controlled separately by FTLogConfig.enableWebViewLog.
WebView host configuration¶
Supported since SDK 0.4.3.
During SDK initialization, configure the WebView host allowlist through FTMobileConfig.allowWebViewHost. It applies to both WebView RUM and logs. The RUM configuration entry in earlier versions remains compatible; migrate as follows:
const config: FTMobileConfig = {
datakitUrl: 'http://10.0.0.1:9529',
+ allowWebViewHost: ['example.com'],
};
await FTMobileReactNative.sdkConfig(config);
const rumConfig: FTRUMConfig = {
androidAppId: Config.ANDROID_APP_ID,
iOSAppId: Config.IOS_APP_ID,
- allowWebViewHost: ['example.com'],
};
await FTReactNativeRUM.setConfig(rumConfig);
null allows all hosts, and [] blocks all hosts. If FTMobileConfig.allowWebViewHost is not set, FTRUMConfig.allowWebViewHost is used; if neither is set, all hosts are allowed. Once the base configuration is explicitly set (including null or []), the base configuration takes precedence.
After remote configuration is enabled, rumAllowWebViewHost takes precedence over the local configuration, and the field names remain unchanged. For details, see Remote configuration fields.
Initialize the web page¶
After completing the App-side configuration above, proceed to Page initialization, then check reporting as described in WebView data verification.
For Session Replay, see React Native Session Replay for App-side configuration and Web Session Replay for page-side configuration.
WebView logs¶
Supported since SDK 0.4.3.
Use FTLogConfig.enableWebViewLog to receive logs generated by the Browser Logs SDK on WebView pages. This is disabled by default. The page side still needs to integrate and initialize the Browser Logs SDK; enabling the Native configuration alone does not automatically install the logging SDK in the web page.
const logConfig: FTLogConfig = {
enableWebViewLog: true,
logSamplingRate: 100,
enableLinkRumData: true,
};
await FTReactNativeLog.logConfig(logConfig);
enableWebViewLog is independent of enableCustomLog, which controls Native custom logs, and enableTraceWebView, which controls WebView RUM. It is also subject to the WebView host allowlist.
After remote configuration is enabled, logEnableWebViewLog can override the local switch. override.logEnableWebViewLog in the remote configuration override rules can also be set to true or false; if omitted, the server-side value is retained. For details, see Remote configuration fields.
To associate Native RUM, initialize RUM first and generate a valid View; log sampling and level filtering continue to be controlled by the Log configuration. On Android, complete the WebView integration configuration for ft-plugin.
For sharing Visitor ID between Native and WebView, see Visitor ID.