Flutter SDK - Tracking screens and views

Details about tracking screens and views with the Flutter tracker

Flutter SDK ⁠-⁠ Tracking screens and views

With analytics enabled (the default), the tracker captures taps, swipes, viewport changes and input events on its own. Screens and individual views are reported by two exported widgets.

Add ORNavigatorObserver to your app’s navigator to record route transitions:

import 'package:openreplay/openreplay.dart';

MaterialApp(
  navigatorObservers: [ORNavigatorObserver()],
  // ...
)

Pushes, pops, replacements and removals are all reported. A route is named by route.settings.name; an unnamed route falls back to its position in the stack (route/2), so named routes make for much more readable timelines.

Wrap any widget in ORTrackedView to report it as a named, observable view. A visibility event is emitted when it mounts and when it unmounts, and its name is used as the label for touches landing inside it.

  • screenName: String — screen or feature title
  • viewName: String — name of the tracked view
import 'package:openreplay/openreplay.dart';

ORTrackedView(
  screenName: 'Checkout',
  viewName: 'Pay button',
  child: ElevatedButton(onPressed: _pay, child: const Text('Pay')),
)

Taps and swipes are captured through the pointer router’s global route, so the tracker sees every pointer event without ever competing in the gesture arena — it cannot swallow a tap your app needed. A pointer that travels more than 10 logical pixels is recorded as a swipe with its dominant direction, anything shorter as a click.

Touch labels come from hit-testing the text under the pointer, or from the enclosing ORTrackedView.

If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.