atatus_webview_tracking 1.0.4 copy "atatus_webview_tracking: ^1.0.4" to clipboard
atatus_webview_tracking: ^1.0.4 copied to clipboard

PlatformAndroid

A package for tracking Atatus sessions in a webview

Overview #

This package is an extension to the atatus_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 atatus_webview_tracking package and the webview_flutter package to your pubspec.yaml:

dependencies:
  webview_flutter: ^4.0.4
  atatus_flutter_plugin: ^1.3.0
  atatus_webview_tracking: ^1.0.1

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

For example:

import 'package:atatus_flutter_plugin/atatus_flutter_plugin.dart';
import 'package:atatus_webview_tracking/atatus_webview_tracking.dart';

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

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