Adding Real-Time Analytics with Firebase Analytics 10.x in Flutter
Jul 24, 2025



Summary
Summary
Summary
Summary
This tutorial shows how to integrate Firebase Analytics 10.x into a Flutter mobile app. You’ll configure your Firebase project, initialize analytics in Flutter, log custom events, set user properties, automate screen tracking, and view data in real time with Firebase DebugView. Follow best practices for naming, batching, and verifying events to build a reliable analytics pipeline.
This tutorial shows how to integrate Firebase Analytics 10.x into a Flutter mobile app. You’ll configure your Firebase project, initialize analytics in Flutter, log custom events, set user properties, automate screen tracking, and view data in real time with Firebase DebugView. Follow best practices for naming, batching, and verifying events to build a reliable analytics pipeline.
This tutorial shows how to integrate Firebase Analytics 10.x into a Flutter mobile app. You’ll configure your Firebase project, initialize analytics in Flutter, log custom events, set user properties, automate screen tracking, and view data in real time with Firebase DebugView. Follow best practices for naming, batching, and verifying events to build a reliable analytics pipeline.
This tutorial shows how to integrate Firebase Analytics 10.x into a Flutter mobile app. You’ll configure your Firebase project, initialize analytics in Flutter, log custom events, set user properties, automate screen tracking, and view data in real time with Firebase DebugView. Follow best practices for naming, batching, and verifying events to build a reliable analytics pipeline.
Key insights:
Key insights:
Key insights:
Key insights:
Project Setup with Firebase Analytics 10.x: Configure Gradle, CocoaPods, and Firebase console files for Android and iOS.
Integrating Firebase Analytics in Flutter: Initialize
firebase_core
and obtain a singletonFirebaseAnalytics
instance inmain.dart
.Logging Custom Events: Use
analytics.logEvent
with parameter maps to capture user interactions.Setting User Properties and Tracking Screens: Define user properties with
setUserProperty
and automate screen tracking via aRouteObserver
.Utilizing Real-Time Dashboard View: Enable DebugView for live validation of events and properties during development.
Introduction
Real-time analytics are crucial for understanding user behavior and making data-driven decisions in mobile development. With Firebase Analytics 10.x and Flutter, you can seamlessly log events, set user properties, and view live data in the Firebase console’s DebugView. This tutorial walks through configuration, integration, custom event logging, screen tracking, and leveraging real-time dashboards using the latest Firebase Analytics SDK in a Flutter app.
Project Setup with Firebase Analytics 10.x
Create or open your Firebase project at console.firebase.google.com.
Add an Android and/or iOS app, then download
google-services.json
(Android) orGoogleService-Info.plist
(iOS).Place these files in your Flutter project under
android/app/
andios/Runner/
respectively.Update Gradle (Android) and
Podfile
(iOS) to use Google services plugins and Firebase BOM 31.1.0+:android/build.gradle: dependencies { classpath 'com.google.gms:google-services:4.3.15' } android/app/build.gradle: dependencies { implementation platform('com.google.firebase:firebase-bom:31.1.0') implementation 'com.google.firebase:firebase-analytics' }
For iOS, run
pod install
inios/
directory after addingpod 'Firebase/Analytics'
to your Podfile.
Integrating Firebase Analytics in Flutter
Add the Flutter plugin to your pubspec.yaml
:
dependencies:
flutter:
sdk: flutter
firebase_core: ^2.15.0
firebase_analytics
Initialize Firebase in main.dart
before running the app:
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
Then instantiate the analytics instance once, ideally at the top level:
final FirebaseAnalytics analytics = FirebaseAnalytics.instance;
Logging Custom Events
Custom events let you capture user interactions beyond predefined events. Use the logEvent
API to send key-value pairs:
void logPurchase(String itemId, double price) {
analytics.logEvent(
name: 'purchase',
parameters: {
'item_id': itemId,
'price': price,
'currency': 'USD'
},
);
}
Call this method whenever a user completes a purchase, views a product, or performs any action you wish to track. Firebase automatically batches and uploads events in the background, optimizing network usage.
Setting User Properties and Tracking Screens
User properties provide context about user segments. Screen tracking helps identify where users spend time.
Set a property:
analytics.setUserProperty(name: 'preferred_language', value: 'en');
Track screen views manually when you’re not using Navigator observers:
void logScreenView(String screenName) {
analytics.logScreenView(
screenClassOverride: screenName,
screenName: screenName,
);
}
Alternatively, you can integrate a RouteObserver<ModalRoute>
to automatically report screen changes:
class AnalyticsRouteObserver extends RouteObserver<ModalRoute<dynamic>> {
void didPush(Route route, Route? previousRoute) {
if (route.settings.name != null) {
analytics.logScreenView(
screenName: route.settings.name,
screenClassOverride: route.settings.name,
);
}
}
}
Register this observer in your MaterialApp
:
MaterialApp(
navigatorObservers: [AnalyticsRouteObserver()],
// ...
)
Utilizing Real-Time Dashboard View
Firebase DebugView provides real-time visibility into events from a development device. To enable it:
Connect your device via USB or use an emulator.
For Android, run:
adb shell setprop debug.firebase.analytics.app your.package.name
.For iOS, add
-FIRDebugEnabled
flag in Xcode’s Scheme > Arguments.Go to Analytics > DebugView in Firebase console.
Now, any logEvent
, screen view, or property you set will appear within seconds. Use DebugView to verify event names, parameters, and user properties before deploying to production.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Integrating Firebase Analytics 10.x in your Flutter app equips you with powerful, real-time insights into user behavior. From project setup to custom events, screen tracking, and DebugView, these tools help you optimize user flows and drive engagement. By following best practices—structuring event names, batching logs, and verifying with DebugView—you’ll build a robust analytics foundation for any mobile development project.
Introduction
Real-time analytics are crucial for understanding user behavior and making data-driven decisions in mobile development. With Firebase Analytics 10.x and Flutter, you can seamlessly log events, set user properties, and view live data in the Firebase console’s DebugView. This tutorial walks through configuration, integration, custom event logging, screen tracking, and leveraging real-time dashboards using the latest Firebase Analytics SDK in a Flutter app.
Project Setup with Firebase Analytics 10.x
Create or open your Firebase project at console.firebase.google.com.
Add an Android and/or iOS app, then download
google-services.json
(Android) orGoogleService-Info.plist
(iOS).Place these files in your Flutter project under
android/app/
andios/Runner/
respectively.Update Gradle (Android) and
Podfile
(iOS) to use Google services plugins and Firebase BOM 31.1.0+:android/build.gradle: dependencies { classpath 'com.google.gms:google-services:4.3.15' } android/app/build.gradle: dependencies { implementation platform('com.google.firebase:firebase-bom:31.1.0') implementation 'com.google.firebase:firebase-analytics' }
For iOS, run
pod install
inios/
directory after addingpod 'Firebase/Analytics'
to your Podfile.
Integrating Firebase Analytics in Flutter
Add the Flutter plugin to your pubspec.yaml
:
dependencies:
flutter:
sdk: flutter
firebase_core: ^2.15.0
firebase_analytics
Initialize Firebase in main.dart
before running the app:
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
Then instantiate the analytics instance once, ideally at the top level:
final FirebaseAnalytics analytics = FirebaseAnalytics.instance;
Logging Custom Events
Custom events let you capture user interactions beyond predefined events. Use the logEvent
API to send key-value pairs:
void logPurchase(String itemId, double price) {
analytics.logEvent(
name: 'purchase',
parameters: {
'item_id': itemId,
'price': price,
'currency': 'USD'
},
);
}
Call this method whenever a user completes a purchase, views a product, or performs any action you wish to track. Firebase automatically batches and uploads events in the background, optimizing network usage.
Setting User Properties and Tracking Screens
User properties provide context about user segments. Screen tracking helps identify where users spend time.
Set a property:
analytics.setUserProperty(name: 'preferred_language', value: 'en');
Track screen views manually when you’re not using Navigator observers:
void logScreenView(String screenName) {
analytics.logScreenView(
screenClassOverride: screenName,
screenName: screenName,
);
}
Alternatively, you can integrate a RouteObserver<ModalRoute>
to automatically report screen changes:
class AnalyticsRouteObserver extends RouteObserver<ModalRoute<dynamic>> {
void didPush(Route route, Route? previousRoute) {
if (route.settings.name != null) {
analytics.logScreenView(
screenName: route.settings.name,
screenClassOverride: route.settings.name,
);
}
}
}
Register this observer in your MaterialApp
:
MaterialApp(
navigatorObservers: [AnalyticsRouteObserver()],
// ...
)
Utilizing Real-Time Dashboard View
Firebase DebugView provides real-time visibility into events from a development device. To enable it:
Connect your device via USB or use an emulator.
For Android, run:
adb shell setprop debug.firebase.analytics.app your.package.name
.For iOS, add
-FIRDebugEnabled
flag in Xcode’s Scheme > Arguments.Go to Analytics > DebugView in Firebase console.
Now, any logEvent
, screen view, or property you set will appear within seconds. Use DebugView to verify event names, parameters, and user properties before deploying to production.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Integrating Firebase Analytics 10.x in your Flutter app equips you with powerful, real-time insights into user behavior. From project setup to custom events, screen tracking, and DebugView, these tools help you optimize user flows and drive engagement. By following best practices—structuring event names, batching logs, and verifying with DebugView—you’ll build a robust analytics foundation for any mobile development project.
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.











