1

Is there any API to show firebase analytics in the flutter app?

  • So if I understand correctly you would like to show the data obtained from your app's analytics in an app? – Francesco - FL Feb 01 '23 at 13:16
  • yes..i want to display firebase analytics in my flutter app – Hizba Mehwish Feb 01 '23 at 13:17
  • Search is your friend here: https://www.google.com/search?q=Is+there+any+API+to+show+firebase+analytics+in+the+flutter+app%3F, and from there: https://stackoverflow.com/questions/71230923/how-to-retrieve-analytics-data-from-firebase-in-flutter. The API that allows retrieval is REST based, so you can call it from almost any platform (including Flutter). – Frank van Puffelen Feb 01 '23 at 15:15
  • @HizbaMehwish please find the answer below. It will helpful and mark its useful – Rameshkumar Feb 08 '23 at 19:00

2 Answers2

0

Firebase Analytics Integration

Create a new class with the name FirebaseAnalyticsService

import ‘package:firebase_analytics/firebase_analytics.dart’;

import ‘package:firebase_analytics/observer.dart’;

class FirebaseAnalyticsService {

final FirebaseAnalytics _analytics = FirebaseAnalytics();

FirebaseAnalyticsObserver appAnalyticsObserver() =>

FirebaseAnalyticsObserver(analytics: _analytics);}

Now register this class in our servicelocator file:

serviceLocator.registerLazySingleton(() => FirebaseAnalyticsService());

reference: https://medium.datadriveninvestor.com/how-to-add-firebase-analytics-to-your-flutter-app-641fbda1d224

Rameshkumar
  • 264
  • 1
  • 12
0

You may consider Google Analytics Data API which gives you programmatic access to Google Analytics 4 (GA4) report data. Note that data isn't in realtime and reporting also undergoes delays in processing as described in this blog post.

dani
  • 354
  • 7