firebase_analytics 0.1.2 firebase_analytics: ^0.1.2 copied to clipboard
Firebase Analytics plugin for Flutter.
Firebase Analytics for Flutter #
A Flutter plugin to use the Firebase Analytics API.
For Flutter plugins for other Firebase products, see FlutterFire.md.
Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!
Usage #
To use this plugin, add firebase_analytics
as a dependency in your pubspec.yaml file.
Track PageRoute Transitions #
To track PageRoute
transitions, add a FirebaseAnalyticsObserver
to the list of NavigatorObservers
on your
Navigator
, e.g. if you're using a MaterialApp
:
FirebaseAnalytics analytics = new FirebaseAnalytics();
MaterialApp(
home: new MyAppHome(),
navigatorObservers: [
new FirebaseAnalyticsObserver(analytics: analytics),
],
);
You can also track transitions within your PageRoute
(e.g. when the user switches from one tab to another) by
implementing RouteAware
and subscribing it to FirebaseAnalyticsObserver
. See examples/lib/tabs_page.dart
for an example of how to wire that up.
Getting Started #
See the example
directory for a complete sample app using Firebase Analytics.