【问题标题】:Android Firebase Analytics events dont display on consoleAndroid Firebase Analytics 事件不显示在控制台上
【发布时间】:2017-01-26 21:46:00
【问题描述】:

我已在我的 android 项目中集成了 firebase 分析。我正在尝试捕获屏幕访问事件,例如。

    Bundle params = new Bundle();
    params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "Custom  screen");
    params.putString(FirebaseAnalytics.Param.ITEM_NAME,"Custom screen name");
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);

我也用这个代码从谷歌示例项目中尝试过

    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "test name");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); 

我的调试日志显示事件已成功发布。

09-19 14:22:15.364 I/FA      ( 3313): App measurement is starting up, version: 9452
09-19 14:22:15.364 I/FA      ( 3313): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-19 14:22:15.364 D/FA      ( 3313): Debug logging enabled
09-19 14:22:15.365 D/FA      ( 3313): AppMeasurement singleton hash: 233567450
09-19 14:22:15.383 V/FA      ( 3313): Collection enabled
09-19 14:22:15.383 V/FA      ( 3313): App package, google app id: com.prabhu.test, 1:64059382301:android:4262dc7062227fc8
09-19 14:22:15.393 V/FA      ( 3313): Registered activity lifecycle callback
09-19 14:22:15.403 V/FA      ( 3313): Using measurement service
09-19 14:22:15.404 V/FA      ( 3313): Connecting to remote service
09-19 14:22:15.433 V/FA      ( 3313): onActivityCreated
09-19 14:22:15.529 I/FA      ( 3313): Tag Manager is not found and thus will not be used
09-19 14:22:15.529 D/FA      ( 3313): Logging event (FE): select_content, Bundle[{item_name=test name, _o=app, content_type=image, item_id=1}]
09-19 14:22:15.530 V/FA      ( 3313): Using measurement service
09-19 14:22:15.530 V/FA      ( 3313): Connection attempt already in progress
09-19 14:22:15.532 D/FA      ( 3313): Logging event (FE): view_item, Bundle[{item_name=Custom screen name, _o=app, item_category=Custom  screen}]
09-19 14:22:15.532 V/FA      ( 3313): Using measurement service
09-19 14:22:15.532 V/FA      ( 3313): Connection attempt already in progress
09-19 14:22:15.532 V/FA      ( 3313): Activity resumed, time: 273496560
09-19 14:22:15.698 D/FA      ( 3313): Connected to remote service
09-19 14:22:15.698 V/FA      ( 3313): Processing queued up service tasks: 3
09-19 14:22:15.751 V/FA-SVC  (10602): Logging event: origin=app,name=select_content,params=Bundle[mParcelledData.dataSize=168]
09-19 14:22:15.766 V/FA-SVC  (10602): Saving event, name, data size: select_content, 79
09-19 14:22:15.768 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='select_content', params=Bundle[{item_name=test name, _o=app, content_type=image, item_id=1}]}
09-19 14:22:16.168 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2557230
09-19 14:22:16.171 V/FA-SVC  (10602): Background event processing time, ms: 423
09-19 14:22:16.171 V/FA-SVC  (10602): Logging event: origin=app,name=view_item,params=Bundle[mParcelledData.dataSize=176]
09-19 14:22:16.175 V/FA-SVC  (10602): Saving event, name, data size: view_item, 84
09-19 14:22:16.175 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='view_item', params=Bundle[{item_name=Custom screen name, _o=app, item_category=Custom  screen}]}
09-19 14:22:16.212 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2557187
09-19 14:22:16.215 V/FA-SVC  (10602): Background event processing time, ms: 44
09-19 14:22:20.723 V/FA      ( 3313): Inactivity, disconnecting from AppMeasurementService
09-19 14:22:22.384 V/FA      ( 3313): Activity paused, time: 273503415
09-19 14:22:23.515 V/FA      ( 3313): onActivityCreated
09-19 14:22:23.531 D/FA      ( 3313): Logging event (FE): select_content, Bundle[{item_name=test name, _o=app, content_type=image, item_id=1}]
09-19 14:22:23.531 V/FA      ( 3313): Using measurement service
09-19 14:22:23.531 V/FA      ( 3313): Connecting to remote service
09-19 14:22:23.539 D/FA      ( 3313): Logging event (FE): view_item, Bundle[{item_name=Custom screen name, _o=app, item_category=Custom  screen}]
09-19 14:22:23.539 V/FA      ( 3313): Using measurement service
09-19 14:22:23.539 V/FA      ( 3313): Connection attempt already in progress
09-19 14:22:23.539 V/FA      ( 3313): Activity resumed, time: 273504562
09-19 14:22:23.594 D/FA      ( 3313): Connected to remote service
09-19 14:22:23.594 V/FA      ( 3313): Processing queued up service tasks: 2
09-19 14:22:23.602 V/FA-SVC  (10602): Saving event, name, data size: select_content, 79
09-19 14:22:23.603 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='select_content', params=Bundle[{item_name=test name, _o=app, content_type=image, item_id=1}]}
09-19 14:22:23.630 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2549768
09-19 14:22:23.632 V/FA-SVC  (10602): Background event processing time, ms: 35
09-19 14:22:23.632 V/FA-SVC  (10602): Logging event: origin=app,name=view_item,params=Bundle[mParcelledData.dataSize=176]
09-19 14:22:23.636 V/FA-SVC  (10602): Saving event, name, data size: view_item, 84
09-19 14:22:23.636 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='view_item', params=Bundle[{item_name=Custom screen name, _o=app, item_category=Custom  screen}]}
09-19 14:22:23.648 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2549750
09-19 14:22:23.651 V/FA-SVC  (10602): Background event processing time, ms: 18
09-19 14:22:26.687 V/FA      ( 3313): Session started, time: 273507718
09-19 14:22:26.699 D/FA      ( 3313): Logging event (FE): _s, Bundle[{_o=auto}]
09-19 14:22:26.709 V/FA-SVC  (10602): Logging event: origin=auto,name=_s,params=Bundle[mParcelledData.dataSize=36]
09-19 14:22:26.738 V/FA-SVC  (10602): Saving event, name, data size: _s, 19
09-19 14:22:26.739 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='_s', params=Bundle[{_o=auto}]}
09-19 14:22:26.754 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2546644
09-19 14:22:26.757 V/FA-SVC  (10602): Background event processing time, ms: 48
09-19 14:22:31.717 V/FA      ( 3313): Inactivity, disconnecting from AppMeasurementService
09-19 14:24:23.422 V/FA      ( 3313): Activity paused, time: 273624439
09-19 14:24:24.423 D/FA      ( 3313): Application backgrounded. Logging engagement
09-19 14:24:24.427 D/FA      ( 3313): Logging event (FE): _e, Bundle[{_o=auto, _et=126732}]
09-19 14:24:24.427 V/FA      ( 3313): Using measurement service
09-19 14:24:24.428 V/FA      ( 3313): Connecting to remote service
09-19 14:24:24.444 D/FA      ( 3313): Connected to remote service
09-19 14:24:24.444 V/FA      ( 3313): Processing queued up service tasks: 1
09-19 14:24:24.450 V/FA-SVC  (10602): Logging event: origin=auto,name=_e,params=Bundle[mParcelledData.dataSize=60]
09-19 14:24:24.480 V/FA-SVC  (10602): Saving event, name, data size: _e, 30
09-19 14:24:24.481 V/FA-SVC  (10602): Event recorded: Event{appId='com.prabhu.test', name='_e', params=Bundle[{_o=auto, _et=126732}]}
09-19 14:24:24.500 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2428898
09-19 14:24:24.505 V/FA-SVC  (10602): Background event processing time, ms: 56
09-19 14:24:29.455 V/FA      ( 3313): Inactivity, disconnecting from AppMeasurementService

但是,在我的 firebase 分析控制台中没有显示事件。

请帮帮我,我怎么了? 仅供参考,对于同一个 Google Firebase Analytics 项目,事件显示在 IOS 应用程序中。

【问题讨论】:

  • 在控制台上显示需要 24 小时。
  • 我知道。对于其他项目,我一直在等待 36 小时
  • 第一次需要更多时间来记录事件。

标签: android firebase firebase-analytics


【解决方案1】:

看日志:

09-19 14:22:16.168 V/FA-SVC  (10602): Upload scheduled in approximately ms: 2557230

2557230 ms 表示42 min 37 sec

然后他们似乎也定期生成报告,但不是实时的。

https://firebase.google.com/docs/analytics/android/events

您可以在 Firebase 中查看有关您的事件的汇总统计信息 控制台仪表板。这些仪表板在整个过程中定期更新 那天。要立即进行测试,请使用 logcat 输出,如中所述 上一节。

更新

请参阅 Firebase Analytics 产品经理 Steve Ganem 的 this answer

目前无法手动覆盖这些设置。 但是,我们认识到需要更快地查看您的报告,并且 我们希望尽快解决这一需求。

但是,在同一个线程上,Yoxi 通过清除应用程序数据更快地找到了force initial upload 的方法。我自己做了,我可以看到最初的上传。但这似乎并没有让数据更快地在 Firebase 控制台中可见。

11-04 14:46:14.112 V/FA      (24746): Upload scheduled in approximately ms: 9028

【讨论】:

    【解决方案2】:

    你可以运行 setprop adb shell setprop debug.firebase.analytics.app <package name>

    例如adb shell setprop debug.firebase.analytics.app com.google.android.play.games

    如果您运行此程序,Firebase 分析事件会近乎实时地上传。

    查看更多详情

    https://firebase.google.com/docs/analytics/debugview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-21
      • 2017-01-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多