在add\u to\u cart not working(android)中将item arraylist设置为firebase analytics事件

goucqfw6  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(249)

我在firebase事件中将\u添加到\u购物车的代码如下:

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控制台中获取项目列表。请帮帮我!

ffscu2ro

ffscu2ro1#

我注意到您无法在firebase控制台中看到items参数。经检查,在firebase端有一个关于此问题的内部错误。预计它还不会显示在firebase控制台(debugview、dashboard等)中。但是,这个参数可以在bigquery中看到,但是它只支持零售/电子商务事件。

相关问题