Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter log event with google analytics

I have set up Google Analytics with in my flutter app. It all seems to be working as standard, with data coming through and being displayed on the analytics console screen, showing users, events count that sort of thing.

I see the default events are: user_engagement, screen_view, session_start, first_open, app_remove, app_clear_data.

These are all having event count data coming through fine. I want to set up my own custom event within the flutter app. I have tried this...

_sendAnalyticsEvent() async {
    FirebaseAnalytics analytics = FirebaseAnalytics();

    await analytics.logEvent(
      name: "save_plant",
      parameters: <String, dynamic>{
        'plant_name': currentPlant.name,
        'plant_species': currentPlant.species,
        'plant_group': currentPlant.group,
        'new_plant': widget.newPlant
      },
    );
  }

... but nothing seems to be coming through on the events. Am I missing something here with doing custom events with a flutter app? I have the google-services.json file correctly in the android app directory.

like image 704
Michael Johnston Avatar asked Jan 25 '23 07:01

Michael Johnston


1 Answers

When You log an event with FirebaseAnalytics, it takes up to 24 hours to get it available in the Events dashboard.

If You want to test "real time" logging, You should try the Debug View (link).

After You set it up for a specific device (there are two easy steps, check it out here), You will see each event only a few seconds after You log it from Your app, in the DebugView section.

enter image description here

like image 142
Aleksandar Avatar answered Feb 02 '23 21:02

Aleksandar