You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current approach to screen/route tracking relies on manual listener attachment for each route change in our app. The existing strategy is non-idiomatic for Flutter and potentially less efficient:
To solve this, I propose implementing CustomerIORouteObserver that leverages Flutter's NavigatorObserver. This approach aligns better with Flutter best practices and allows for more efficient and reliable route tracking. The GoRouter package supports route observers, allowing this new class to integrate seamlessly.
Integration with GoRouter
GoRouter provides a way to attach observers to your routes, enabling cleaner and more idiomatic tracking of screen views. You can easily add the CustomerIORouteObserver to the GoRouter setup like this:
GoRouter(
observers: [CustomerIORouteObserver()],
// ... other configurations
)
By adding the observer directly into GoRouter's observers array, we can automatically and efficiently handle route tracking without requiring any manual intervention for each route change.
With this new setup, every time a route change occurs, the CustomerIORouteObserver will automatically fire and send the necessary tracking information to CustomerIO.
The text was updated successfully, but these errors were encountered:
Great suggestions and I really hope they implement them! I've been really struggling to get screen tracking working with GoRouter and I'm in desperate need of some help.
Problem
The current approach to screen/route tracking relies on manual listener attachment for each route change in our app. The existing strategy is non-idiomatic for Flutter and potentially less efficient:
Proposed Solution
To solve this, I propose implementing
CustomerIORouteObserver
that leverages Flutter'sNavigatorObserver
. This approach aligns better with Flutter best practices and allows for more efficient and reliable route tracking. The GoRouter package supports route observers, allowing this new class to integrate seamlessly.Integration with GoRouter
GoRouter provides a way to attach observers to your routes, enabling cleaner and more idiomatic tracking of screen views. You can easily add the
CustomerIORouteObserver
to the GoRouter setup like this:By adding the observer directly into GoRouter's
observers
array, we can automatically and efficiently handle route tracking without requiring any manual intervention for each route change.Integration with MaterialApp
With this new setup, every time a route change occurs, the
CustomerIORouteObserver
will automatically fire and send the necessary tracking information to CustomerIO.The text was updated successfully, but these errors were encountered: