带有Google Analytics(分析)的Flutter日志事件 [英] Flutter log event with google analytics

查看:107
本文介绍了带有Google Analytics(分析)的Flutter日志事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Flutter应用中设置了Google Analytics(分析).一切似乎都在按标准进行,数据通过并显示在分析控制台屏幕上,向用户显示,事件对这种事情很重要.

我看到默认事件是:user_engagement,screen_view,session_start,first_open,app_remove,app_clear_data.

这些都具有很好的事件计数数据.我想在flutter应用程序中设置自己的自定义事件.我已经尝试过了...

  _sendAnalyticsEvent()异步{FirebaseAnalytics Analytics = FirebaseAnalytics();等待analytics.logEvent(名称:"save_plant",参数:<字符串,动态> {'plant_name':currentPlant.name,'plant_species':currentPlant.species,'plant_group':currentPlant.group,'new_plant':widget.newPlant},);} 

...但是似乎没有发生任何事件.我是否在通过flutter应用程序执行自定义事件而错过了某些东西?我在android应用目录中正确安装了google-services.json文件.

解决方案

使用 FirebaseAnalytics 记录事件时,最多需要 24小时才能使用 Events 仪表板.

如果您想测试实时"日志记录,则应尝试

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.

解决方案

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.

这篇关于带有Google Analytics(分析)的Flutter日志事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆