Skip to content

WebView Data Monitoring

App-side Configuration

First complete SDK initialization. To collect WebView RUM data, you must also complete RUM configuration. Collection is controlled by FTRUMManager().setConfig(enableTraceWebView: true) and is enabled by default (true).

On Android, follow ft-plugin integration to complete the WebView instrumentation configuration.

WebView Host Configuration

The base configuration entry is supported since SDK 0.5.8.

Use allowWebViewHost in FTMobileFlutter.sdkConfig() to configure the hosts allowed for WebView RUM and log collection in one place. The legacy RUM configuration entry is retained for compatibility; the following migration is recommended:

 await FTMobileFlutter.sdkConfig(
   datawayUrl: datawayUrl,
   cliToken: cliToken,
+  allowWebViewHost: ['example.com'],
 );
 await FTRUMManager().setConfig(
   androidAppId: appAndroidId,
   iOSAppId: appIOSId,
   enableTraceWebView: true,
-  allowWebViewHost: ['example.com'],
 );

If the base configuration is not set, the allowWebViewHost of the legacy RUM configuration is used. If neither is set, all hosts are allowed. Explicitly passing an empty list [] means no host is allowed. The priority is: remote rumAllowWebViewHost > base configuration allowWebViewHost > legacy RUM configuration.

Initialize the Web Page

After completing the App-side configuration, proceed to page initialization, then check reporting according to WebView data verification.

For the Session Replay configuration of Flutter views and the WebView support scope, see Flutter Session Replay.

WebView Log Collection

Supported since SDK 0.5.8.

The web page must integrate and initialize the Browser Logs SDK. On the Flutter side, use FTLogger().logConfig(enableWebViewLog: true) to enable receiving WebView logs, which are processed and uploaded by the App SDK. This is disabled by default.

await FTLogger().logConfig(
  enableWebViewLog: true,
  logSamplingRate: 100.0,
  enableLinkRumData: true, // Associate with RUM as needed
);

enableWebViewLog is independent of the custom log switch enableCustomLog and the WebView RUM switch enableTraceWebView, and is subject to the WebView host configuration. To associate logs with RUM, initialize RUM first and generate a valid View. For log sampling, level filtering, and cache configuration, see Log configuration.

After enabling remote configuration, you can override the local switch with logEnableWebViewLog. For supported fields and how they take effect, see Flutter remote configuration fields.

Feedback

Is this page helpful?