Reliable Targets

The identifier associated with each widget in your app is the concatenation of the list of its ancestors in the Flutter tree view.

Here we have an example of the widget tree of a Flutter app:

main.dart
Widget _buildMyAwesomeContent() {
return Column(
children: const [
Text('Answer to the Ultimate Question of Life, The Universe, and Everything'),
Text('is'),
Text('42'),
],
);
}

You may always want to use the same id for this widget, even if you publish a new version of the app in which it has been moved in the tree view.

Having a Reliable Target for a widget enables the analysis of data across various Snapshots from different dates and versions, including layouts or different A/B testing variations.

Here are examples of how the Reliable Targets feature can be used:

  • Tracking elements that can dynamically move on a page (e.g., Customizable profile page).
  • Tracking elements that you want to monitor from one version to another, even if their position changes (e.g., Moving carousel position from top to bottom).
  • Tracking elements during A/B testing (e.g., Testing new and old Product page on the same version).
  • Tracking elements that can be used on multiple pages (e.g., Search bar).
  • Ensuring that a call to action has a unique identifier wherever it appears on a screen (e.g., AddtoCart button).

The Contentsquare Flutter SDK provides a ReliableTarget widget that can be used to wrap the widget you want to track reliably.

ReliableTarget accepts a mandatory name argument that allows the identification of the component to track. Here is an example of how to use it with the code above:

main.dart
Widget _buildMyAwesomeContent() {
return ReliableTarget(
name: '42_is_the_answer',
child: Column(
children: const [
Text('Answer to the Ultimate Question of Life, The Universe, and Everything'),
Text('is'),
Text('42'),
],˝
),
);
}
  • name must be unique to effectively use the feature
  • name should NOT be empty
  • name for the same ReliableTarget must be the same across different versions of the app