Search code examples
dartflutterfirebase-analytics

Flutter Firebase Analytics Not Logging Event


Hi I just added Firebase Analytics to my flutter application. I have added two functions.

  1. Set Current Screen.
  2. Log Event.

Set Current Screen is working fine. I am able to see the screens in Analytics/Events/Screen_views. So the Firebase configurations must have been correct.

Log Event is not showing any Error, but it is not shown anywhere in the firebase dashboard. I have an Event "Home page Loaded". This is my code.

I have waited for more than 48 hours now.

await analytics.logEvent( name: eventName, parameters: { }, );

Has anyone implemented Firebase Analytics in Flutter Application.


Solution

  • You cannot have spaces in the event or parameter name, only in values, change Home page Loaded to Home_page_Loaded (personally I like to see all lowercase).

    From the docs:

    The name of the event. Should contain 1 to 40 alphanumeric characters or underscores. The name must start with an alphabetic character. Some event names are reserved

    https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics#logEvent(java.lang.String,%20android.os.Bundle)