Flutter
Install the Flutter SDK and track app sessions.
Last updated June 3, 2026
Install the Flutter SDK, initialize it on app boot, and track route changes as screen_view events. See what the SDK can do →.
Prerequisites
- A Grometrics site ID from Settings > Tracking
- Access to the mobile app code
- A debug build or simulator for verification
Steps
Add version 1.1.1
Install the Flutter package.
terminal
1flutter pub add grometrics:^1.1.1Create and start the tracker
Initialize one tracker before the first screen renders.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
main.dart
1final grometrics = GrometricsTracker(2configuration: const GrometricsConfiguration(3websiteId: 'YOUR_SITE_ID',4),5);6await grometrics.start();
Identify and reset
Identify after login, then reset before sign-out on a shared device.
auth.dart
1await grometrics.identify(user.id);23await grometrics.reset();4await auth.signOut();
Track route changes
Send readable route names from your navigator observer.
app.dart
1await grometrics.trackScreen(2name: 'Checkout',3path: '/checkout',4);
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| websiteId | string | ✓ | Your Grometrics site ID |
| appVersion | string | no | Populates app version filters |
What happens next
Run the app and navigate between routes. Realtime should show app_open and screen_view events.
Verify your setup
Verify your setup
Troubleshooting
No event appears
Confirm the site ID matches Settings > Tracking and that the latest published code is running.
Was this page helpful?