
If there is a need for some custom implementation of tracking screens and events, it has to be manually implemented. FirebaseAnalytics analytics = FirebaseAnalytics() įirebaseAnalyticsObserver(analytics: analytics),īy implementing FirebaseAnalyticsObserver in this way, it automatically tracks every page transition made with Navigator – every named route. To track the PageRoute transitions, FirebaseAnalyticsObserver needs to be added to the list of NavigatorObservers on app Navigator. Initialize FirebaseAnalyticsįirst thing is the initialisation of the FirebaseAnalytics. After that all prework is done and we can start implementing desired functionalities of the Analytics.
#Flutter firebase analytics android
If the registered application is an Android app, then the google-services.json file configuration file is generated which needs to be put in the android/app directory. If the registered application is an iOS app, then the ist configuration file is generated which needs to be put in the Runner subfolder of the iOS directory of the Flutter project. This is done by registering the app’s Android package name or iOS bundle id and generating the configuration file for every registered package name or bundle id.įirebase configuration in iOS Firebase configuration in Android Also, the platform specific configuration should be implemented in order to connect the app to the Firebase project. In order to use the plugin, it has to be added as a dependency in pubspec.yaml file. There is an official Flutter plugin for adding Google Analytics for Firebase on pub.dev. Step-by-step process of adding Google Analytics for Firebase to a Flutter app
#Flutter firebase analytics update
That way everything related to Firebase Analytics is in one place, easy to edit and update, but also easy to add new features in the future.Īlso, since Flutter is still fresh, we can count on breaking changes in some updates of the library – so as said, we have everything regarding Analytics on one place and only one place to update possible breaking changes. On a few projects we had, Firebase Analytics was the feature that needed to be implemented. The best approach to this is to have only one class where everything for Firebase Analytics is handled.

Why we used Firebase Analytics in Flutter

Engagement insights – every user interaction with the application can be tracked – every screen opening, every button clicked, every triggered event, etc.Audience segmentation – defining custom audiences based on device data, custom events, or user properties.Unlimited reporting on up to 500 distinct events.The benefits of using Google Analytics for FirebaseĪs it says on the Google Analytics for Firebase website, the key capabilities of Google Analytics is that it provides: See here for an introduction to app development with Flutter.įirst, let’s see what the benefits are. We will explain the implementation process on an example of a project we used it for. We will go through the basic implementation of it, see what events are tracked by default and what events require additional implementation in order to be tracked.

In this blog, we will talk about Google Analytics for Firebase and its usage in Flutter.
