将Item arraylist设置为firebase分析事件中的ADD_TO_CART,不起作用(Android)

huangapple go评论141阅读模式
英文:

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&lt;ServiceModel&gt;items, String currency, Long value){
ArrayList&lt;Bundle&gt; products = new ArrayList&lt;&gt;();
for(int i=0;i&lt;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, &quot;&quot;);
product1.putDouble( FirebaseAnalytics.Param.PRICE, items.get(i).getRate() );
product1.putString( FirebaseAnalytics.Param.CURRENCY, &quot;INR&quot; ); // 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(&quot;user_name&quot;, username);
params.putString(&quot;email&quot;, email);
params.putString(&quot;mobile_number&quot;, 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 的选项卡,您可以在其中看到物品。

将Item arraylist设置为firebase分析事件中的ADD_TO_CART,不起作用(Android)

英文:

There is a tab named Items in debug view where you can see items

将Item arraylist设置为firebase分析事件中的ADD_TO_CART,不起作用(Android)

huangapple
  • 本文由 发表于 2020年8月21日 15:16:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/63518200.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定