Skip to content

Files

This branch is 1 commit ahead of, 3391 commits behind flutter/plugins:main.

firebase_analytics

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 7, 2019
May 7, 2019
May 7, 2019
Apr 14, 2019
Apr 3, 2019
May 7, 2019
Sep 14, 2017
Apr 12, 2019
May 7, 2019

Google Analytics for Firebase

pub package

A Flutter plugin to use the Google Analytics for Firebase 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. You must also configure firebase analytics for each platform project: Android and iOS (see the example folder or https://codelabs.developers.google.com/codelabs/flutter-firebase/#4 for step by step details).

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 = FirebaseAnalytics();

MaterialApp(
  home: MyAppHome(),
  navigatorObservers: [
    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 example/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 Google Analytics for Firebase.