Screen Views
Track screen views automatically with navigation observers or manually.
Screen views tell you which parts of your app users visit most and how they navigate through your experience. Adopture supports both automatic and manual screen tracking.
Automatic Tracking (Recommended)
Automatic tracking captures every route change in your app without requiring you to add tracking calls to each screen.
Navigator Observer
If your app uses Flutter's built-in Navigator, add the Adopture observer to your MaterialApp:
MaterialApp(
navigatorObservers: [Adopture.navigationObserver()],
);This captures every push, pop, and replace operation on the navigation stack.
GoRouter Observer
If your app uses go_router, use the dedicated GoRouter observer:
final router = GoRouter(routes: [...]);
Adopture.observeGoRouter(router);The GoRouter observer provides several advantages:
- Automatically tracks all route changes, including
StatefulShellRoutebranches - Smart screen name normalization that produces clean, readable names in your dashboard:
- Query parameters are stripped:
/settings?tab=privacybecomessettings - Long IDs (UUIDs, Firestore document IDs) are normalized:
/users/a1b2c3d4e5f6g7h8i9j0becomesusers/detail - The root path is labeled:
/becomeshome
- Query parameters are stripped:
Using Both Observers
You can use both the Navigator observer and the GoRouter observer together in the same app. Adopture handles deduplication automatically, so the same screen view is never recorded twice.
Manual Tracking
For cases where automatic tracking isn't sufficient, or if you want to track virtual screens that don't correspond to a route change, use the screen method directly:
Adopture.screen('checkout', {'step': '2'});Manual tracking is useful for:
- Tab views within a single route
- Modal screens or bottom sheets
- Onboarding steps within a
PageView - Any screen transition not handled by the router
Dashboard
Screen views appear in the Top Screens section of your dashboard, where you can see which screens are visited most frequently and how screen traffic changes over time.