Android Firebase Analytics: predefined and custom parameters not working

你离开我真会死。 提交于 2019-12-13 03:16:30

问题


I have application which use Firebase SDK and used some predefined event and parameters but some parameters are automatically added but not all parameters

For example Add to cart event

Android :

bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, params.get("item_category").toString());
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, params.get("item_name").toString());
bundle.putString(FirebaseAnalytics.Param.ITEM_LOCATION_ID, params.get("item_location_id").toString());
bundle.putString(FirebaseAnalytics.Param.CURRENCY, params.get("currency").toString());
bundle.putDouble(FirebaseAnalytics.Param.VALUE, ((Number) params.get("value")).doubleValue());
bundle.putString(FirebaseAnalytics.Param.COUPON, params.get("coupon").toString());
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, params.get("item_id").toString());
bundle.putLong(FirebaseAnalytics.Param.QUANTITY, ((Number) params.get("quantity")).longValue());
this.firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, bundle);

IOS

[FIRAnalytics logEventWithName:kFIREventAddToCart parameters:@{
    kFIRParameterItemCategory:[parameters valueForKey:@"item_category"],
    kFIRParameterItemName:[parameters valueForKey:@"item_name"],
    kFIRParameterItemLocationID:[parameters valueForKey:@"item_location_id"],
    kFIRParameterCurrency:[parameters valueForKey:@"currency"],
    kFIRParameterValue:[parameters valueForKey:@"value"],
    kFIRParameterCoupon:[parameters valueForKey:@"coupon"],
    kFIRParameterItemID:[parameters valueForKey:@"item_id"],
    kFIRParameterQuantity:[parameters valueForKey:@"quantity"]
}];

In dashboard, We can see only item_name and value. please help.... thanks in advance


回答1:


I'm supposing that your params object is a composed array with the similar values

{
    "item_category" : "t-shirts",
    "item_name" : "abc",
    "item_location_id" : "ChIJiyj437sx3YAR9kUWC8QkLzQ",
    "currency" : "USD",
    "value" : 3.99,
    "coupon" : "zz123",
    "item_id" : "p7654",
    "quantity" : 1
}

If that is the case then you are in the right way to create the event. But you are trying to see the event values in the Parameter Reporting section in the Firebase Console. I analysed based on the image you attached.

If you want to see the event values I recommend check the event dashboard report by clicking on the event name instead of the tab Parameter Reporting, follow this link, it shows you an example of how Firebase Events are organized in the Dashboard Console.

I hope this helps you.



来源:https://stackoverflow.com/questions/57660104/android-firebase-analytics-predefined-and-custom-parameters-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!