【问题标题】:No data in Firebase custom property even after a day即使过了一天,Firebase 自定义属性中也没有数据
【发布时间】:2017-02-01 07:32:00
【问题描述】:

我正在设置用户属性,但我没有在 Firebase 控制台中获取任何数据。:

  1. 我已将 favorite_food 注册为 Firebase 控制台中的用户属性。

  2. 我正在使用下面的代码来注册事件和设置属性

    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "TempId");
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "TempName Oncreate");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT,bundle);
    
    mFirebaseAnalytics.setUserProperty("favorite_food", "INDIAN FOOD");
    
  3. 执行代码后我等了一天,但我的自定义属性中没有收到任何数据。以下是我从 Firebase 服务获取的日志。请帮帮我。

    02-06 11:04:25.469 7341-24523/test.testfcm D/FA: Setting user property (FE): favorite_food, pizza
    
    02-06 11:04:25.489 7341-24523/test.testfcm V/FA: Using measurement service
    
    02-06 11:04:25.489 7341-24523/test.testfcm V/FA: Connection attempt already in progress
    
    02-06 11:04:25.489 7341-24523/test.testfcm V/FA: Using measurement service
    
    02-06 11:04:25.489 7341-24523/test.testfcm V/FA: Connection attempt already in progress
    
    02-06 11:04:25.489 7341-24523/test.testfcm V/FA: Activity resumed, time: 1093679
    
    02-06 11:04:25.519 7341-24523/test.testfcm D/FA: Connected to remote service
    
    02-06 11:04:25.529 7341-24523/test.testfcm V/FA: Processing queued up service tasks: 3
    
    02-06 11:04:25.609 1300-24541/? V/FA-SVC: Event recorded: Event{appId='test.testfcm', name='select_content', params=Bundle[{item_name=TempName Oncreate, _o=app, content_type=image, item_id=TempId}]}
    
    02-06 11:04:30.599 7341-24523/test.testfcm V/FA: Inactivity, disconnecting from the service
    
    02-06 11:14:25.449 7341-3377/test.testfcm V/FA: Recording user engagement, ms: 600010
    
    02-06 11:14:25.449 7341-3377/test.testfcm V/FA: Using measurement service
    
    02-06 11:14:25.449 7341-3377/test.testfcm V/FA: Connecting to remote service
    
    02-06 11:14:25.459 7341-3377/test.testfcm V/FA: Activity paused, time: 1693688
    
    02-06 11:14:25.479 7341-3377/test.testfcm D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=600010, _sc=MainActivity, _si=367007112786571721}]
    
    02-06 11:14:25.489 7341-3377/test.testfcm V/FA: Using measurement service
    
    02-06 11:14:25.489 7341-3377/test.testfcm V/FA: Connection attempt already in progress
    
    02-06 11:14:25.509 7341-3377/test.testfcm D/FA: Connected to remote service
    
    02-06 11:14:25.509 7341-3377/test.testfcm V/FA: Processing queued up service tasks: 2
    
    02-06 11:14:25.559 1300-3389/? V/FA-SVC: Event recorded: Event{appId='test.testfcm', name='_e', params=Bundle[{_o=auto, _et=600010, _sc=MainActivity, _si=367007112786571721}]}
    
    02-06 11:14:30.539 7341-3377/test.testfcm V/FA: Inactivity, disconnecting from the service
    

【问题讨论】:

  • 很高兴看到您在上面提供的摘录之前和之后的日志信息。例如,在“应用程序测量正在启动,版本:####”的行中会有一个较早的行。那会很高兴看到。它最终上传了您的活动吗?转储事件包的调试行也很高兴看到。这些行以“Uploading data.app, uncompressed size, data:”开头。
  • 我没有看到附加到事件的用户属性“favorite_food”。记录事件时是否总是设置用户属性?设置用户属性后,它将始终附加到所有事件,直到您将其删除。
  • @DanMorenus 感谢您的回复...我第一次在日志中只收到这些行。在我尝试其他手机后,我得到了一个带有 json 键值对和上传数据的新日志。但感谢您的输入。这对我很有帮助。
  • @AlexD 感谢您的回复.. 是的,只要有日志事件,我就会设置 UserProperty。我现在只改变了一件事。我想我应该在记录事件之前调用 setuserproperty() 。我现在改变了它并且它的工作。

标签: firebase firebase-analytics


【解决方案1】:

我在记录事件后设置用户属性。它应该在记录任何事件之前。我更改了如下代码及其工作。

    mFirebaseAnalytics.setUserProperty("favorite_food", "INDIAN FOOD");
    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "TempId");
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "TempName Oncreate");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT,bundle);

【讨论】:

    猜你喜欢
    • 2020-03-25
    • 2020-10-18
    • 1970-01-01
    • 1970-01-01
    • 2023-02-07
    • 1970-01-01
    • 1970-01-01
    • 2015-12-21
    • 2020-02-22
    相关资源
    最近更新 更多