简体   繁体   中英

Set Item arraylist to firebase analytics event in ADD_TO_CART not working (Android)

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!

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.

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM