英文:
Set Item arraylist to firebase analytics event in ADD_TO_CART not working (Android)
问题
以下是您代码中addToCartEvent
函数的翻译部分:
public void addToCartEvent(ArrayList<ServiceModel> items, String currency, Long value){
ArrayList<Bundle> products = new ArrayList<>();
for(int i=0;i<items.size();i++){
Bundle product1 = new Bundle();
product1.putString( FirebaseAnalytics.Param.ITEM_ID, String.valueOf(items.get(i).getId())); // ITEM_ID or ITEM_NAME is required
product1.putString( FirebaseAnalytics.Param.ITEM_NAME, items.get(i).getName());
product1.putString( FirebaseAnalytics.Param.ITEM_CATEGORY, "");
product1.putDouble( FirebaseAnalytics.Param.PRICE, items.get(i).getRate() );
product1.putString( FirebaseAnalytics.Param.CURRENCY, "INR" ); // Item-level currency unused today
product1.putLong( FirebaseAnalytics.Param.QUANTITY, 1);
products.add(product1);
}
Bundle params = new Bundle();
String username = appPreferences.getString(AppPreferences.Keys.NAME);
String email = appPreferences.getString(AppPreferences.Keys.EMAIL);
String mobileNumber = appPreferences.getString(AppPreferences.Keys.MOBILE);
params.putString("user_name", username);
params.putString("email", email);
params.putString("mobile_number", mobileNumber);
params.putString(FirebaseAnalytics.Param.CURRENCY, currency);
params.putDouble(FirebaseAnalytics.Param.VALUE, value);
params.putParcelableArrayList(FirebaseAnalytics.Param.ITEMS,
products);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, params);
}
问题在于我在 Firebase 控制台中没有收到项目列表。请帮助!
英文:
My code for add_to_cart in firebase event is as follows:
public void addToCartEvent(ArrayList<ServiceModel>items, String currency, Long value){
ArrayList<Bundle> products = new ArrayList<>();
for(int i=0;i<items.size();i++){
Bundle product1 = new Bundle();
product1.putString( FirebaseAnalytics.Param.ITEM_ID, String.valueOf(items.get(i).getId())); // ITEM_ID or ITEM_NAME is required
product1.putString( FirebaseAnalytics.Param.ITEM_NAME, items.get(i).getName());
product1.putString( FirebaseAnalytics.Param.ITEM_CATEGORY, "");
product1.putDouble( FirebaseAnalytics.Param.PRICE, items.get(i).getRate() );
product1.putString( FirebaseAnalytics.Param.CURRENCY, "INR" ); // Item-level currency unused today
product1.putLong( FirebaseAnalytics.Param.QUANTITY, 1);
products.add(product1);
}
Bundle params = new Bundle();
String username = appPreferences.getString(AppPreferences.Keys.NAME);
String email = appPreferences.getString(AppPreferences.Keys.EMAIL);
String mobileNumber = appPreferences.getString(AppPreferences.Keys.MOBILE);
params.putString("user_name", username);
params.putString("email", email);
params.putString("mobile_number", mobileNumber);
params.putString(FirebaseAnalytics.Param.CURRENCY, currency);
params.putDouble(FirebaseAnalytics.Param.VALUE, value);
params.putParcelableArrayList(FirebaseAnalytics.Param.ITEMS,
products);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, params);
}
The problem is that i am not getting the list of items in firebase console. Please Help!
答案1
得分: 4
我注意到您在Firebase控制台中无法看到ITEMS参数。经过检查,关于这个问题,Firebase团队已经提出了一个内部bug报告。预计在Firebase控制台(DebugView、仪表盘等)中暂时还不会显示此参数。然而,该参数在BigQuery中是可见的,但仅支持零售/电子商务事件。
英文:
I noticed that you are unable to see ITEMS parameter in the Firebase console. Upon checking, there is an internal bug filed on firebase end regarding this issue. It’s expected that it will not show yet in the Firebase Console (DebugView, dashboard, etc.). However, this parameter can be seen in BigQuery, but it’s only supported for the Retail/Ecommerce events.
答案2
得分: 0
在调试视图中有一个名为 Items 的选项卡,您可以在其中看到物品。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论