How to log Firebase Analytics events in Flutter

5,509

Per my understanding, it takes 24 hours in general to see the events logged in firebase console. But to see if the events are indeed being logged, you can use debugView, located under Analytics sidebar in firebase console.

enter image description here

Before you could use debugView, you'll need to configure the setting by enabling respective emulator or simulator on which you're running the app, as explained here

Once you enable it, you should be able to see the events being logged as you perform action in the app.

Hope this helps.

Share:
5,509
Koji Sato
Author by

Koji Sato

Updated on December 12, 2022

Comments

  • Koji Sato
    Koji Sato over 1 year

    I want to log Firebase event in Flutter, but I cannot log any event. I want to count what times events are done, so when tapping the button, I log the event.

    class Onboarding extends StatefulWidget {
      Onboarding({Key key, this.analytics, this.observer})
          : super(key: key);
    
      final FirebaseAnalytics analytics;
      final FirebaseAnalyticsObserver observer;
    
      @override
      _OnboardingState createState() => _OnboardingState(analytics, observer);
    }
    
    class _OnboardingState extends State<Onboarding> {
      _OnboardingState(this.analytics, this.observer);
      final FirebaseAnalyticsObserver observer;
      final FirebaseAnalytics analytics;
    
    ...
      Future<void> _sendAnalyticsEvent(FirebaseAnalytics analytics, 
    FirebaseAnalyticsObserver observer) async {
        await analytics.logEvent(
          name: 'onboarding'
        );
      }
    
      Materialbotton(
        child: onPressed: () async {
        _sendAnalyticsEvent(analytics, observer);
        ...
        }
      )
    

    However, if I see Firebase console, I see nothing