Skip to main content

kubesense_webview_tracking 1.0.0 copy "kubesense_webview_tracking: ^1.0.0" to clipboard
kubesense_webview_tracking: ^1.0.0 copied to clipboard

A package for tracking Kubesense sessions in a webview

Overview #

This package is an extension to the kubesense_flutter_plugin. It allows Real User Monitoring to monitor web views and eliminate blind spots in your hybrid Flutter applications.

Instrumenting your web views #

The RUM Flutter SDK provides APIs for you to control web view tracking when using the webview_flutter package.

Add both the kubesense_webview_tracking package and the webview_flutter package to your pubspec.yaml:

dependencies:
  webview_flutter: ^4.0.4
  kubesense_flutter_plugin: ^1.0.0
  kubesense_webview_tracking: ^1.0.0

To add Web View Tracking, call the trackKubesenseEvents extension method on WebViewController, providing the list of allowed hosts.

For example:

import 'package:kubesense_flutter_plugin/kubesense_flutter_plugin.dart';
import 'package:kubesense_webview_tracking/kubesense_webview_tracking.dart';

webViewController = WebViewController()
  ..setJavaScriptMode(JavaScriptMode.unrestricted)
  ..trackKubesenseEvents(
    KubesenseSdk.instance,
    ['myapp.example'],
  )
  ..loadRequest(Uri.parse('myapp.example'));

Note that JavaScriptMode.unrestricted is required for tracking to work on Android.