Skip to content

WebView Monitoring

WebView Data Monitoring

For WebView data monitoring, the Web Monitoring SDK needs to be integrated into the WebView page.

If you also need to support data collection from Web applications in desktop browsers, it is recommended to follow the recommended configuration for desktop applications.

When the collection scenario is limited to WebView within the App and does not require supporting Web applications in desktop browsers, you can initialize with any applicationId after completing the basic Web SDK integration configuration.

After normal initialization, the collected data from WebView within the App is managed by the App side by default.

To disable WebView collection or filter the collection scope by host, refer to the following configuration instructions:

  • FTRUMConfig.setEnableTraceWebView
  • FTSDKConfig.setAllowWebViewHost

FTRUMConfig.setAllowWebViewHost is deprecated. After upgrade, use FTSDKConfig.setAllowWebViewHost to uniformly control the host scope of WebView RUM and Log.

WebView Log Collection

Starting from ft-sdk >= 1.7.5, the FTWebViewJavascriptBridge is supported to receive logs generated by the Browser SDK in WebView, and the Android SDK handles log level filtering, sampling, caching, and uploading.

Before enabling this capability, the WebView page must integrate the Web Monitoring SDK and initialize Android Log:

FTSdk.initLogWithConfig(new FTLoggerConfig()
    .setEnableWebViewLog(true)
    .setEnableLinkRumData(true));
FTSdk.initLogWithConfig(
    FTLoggerConfig()
        .setEnableWebViewLog(true)
        .setEnableLinkRumData(true)
)
  • setEnableWebViewLog(true) only enables Browser SDK Log collection and does not depend on the native log's setEnableCustomLog or setEnableConsoleLog.
  • When setEnableLinkRumData(true) is enabled, WebView Log will be associated with Android RUM's Application, Session, and other contexts; when disabled, the RUM-related fields will be removed.
  • FTSDKConfig.setAllowWebViewHost is used to uniformly limit the host scope of WebView RUM and Log. null means all hosts are allowed, an empty array means no automatic use of Bridge, and configured hosts also match their subdomains. This configuration is used for Bridge selection and should not be used as a security verification mechanism for page origin.
  • WebView Log is also controlled by FTLoggerConfig.setSamplingRate, setLogLevelFilters, and the log cache policy, and supports dynamic enable/disable via remote configuration.

Common Troubleshooting Entries

  • If custom WebView auto-collection does not take effect, refer to Troubleshooting.
  • When you need to manually identify custom WebView, refer to the knownWebViewClasses configuration instructions in App Integration.

Feedback

Is this page helpful?