Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // an array where all currently viewed products (products that were loaded on the user's screen) must be included
- val items = arrayOf(
- Bundle().apply {
- putString(FirebaseAnalytics.Param.ITEM_ID, "6349144490158") // insert an actual product ID
- putString(FirebaseAnalytics.Param.ITEM_NAME, "Rib Support Tank - Black") // insert an actual product name
- putDouble(FirebaseAnalytics.Param.PRICE, 64.00) // insert an actual product price. As a Double. Don't include currency code
- putString(FirebaseAnalytics.Param.CURRENCY, "USD") // insert currency here with the correct format 'USD' 'GBP' 'EUR' etc. ISO-4217 format
- putDouble(FirebaseAnalytics.Param.DISCOUNT, 26.00) // insert an actual product discount. Number or a string. Don't include currency code. Whole number of discount, not percentage. If product price is usually 100 and on sale it is 80, then discount is 20
- putString(FirebaseAnalytics.Param.ITEM_BRAND, "alo") // insert an actual product brand
- putString(FirebaseAnalytics.Param.AFFILIATION, "Alo_US") // insert store name region here
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "Women") // insert an actual product top-level category
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY2, "Tops") // if it is possible to drill down the categories (e.g. Apparel, then T-shirt, then Men), use item_category3, etc. Can use from item_category up to item_category5
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY3, "Tanks")
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY4, "")
- putString(FirebaseAnalytics.Param.ITEM_VARIANT, "Black") // insert an actual product variant - in our case the color
- putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, "womens-fdm4") // insert the name of the list where the product is currently displayed
- putLong(FirebaseAnalytics.Param.INDEX, 1) // insert product's position in that list
- putLong(FirebaseAnalytics.Param.QUANTITY, 1) // product quantity. In case of view_item_list, it will usually be equal to 1
- },
- Bundle().apply {
- putString(FirebaseAnalytics.Param.ITEM_ID, "6349051265198") // insert an actual product ID
- putString(FirebaseAnalytics.Param.ITEM_NAME, "High-Waist Goddess Legging - Gravel/Pristine") // insert an actual product name
- putDouble(FirebaseAnalytics.Param.PRICE, 102.00) // insert an actual product price. As a Double. Don't include currency code
- putString(FirebaseAnalytics.Param.CURRENCY, "USD") // insert currency here with the correct format 'USD' 'GBP' 'EUR' etc. ISO-4217 format
- putDouble(FirebaseAnalytics.Param.DISCOUNT, 41.00) // insert an actual product discount. Number or a string. Don't include currency code. Whole number of discount, not percentage. If product price is usually 100 and on sale it is 80, then discount is 20
- putString(FirebaseAnalytics.Param.ITEM_BRAND, "alo") // insert an actual product brand
- putString(FirebaseAnalytics.Param.AFFILIATION, "Alo_US") // insert store name region here
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "Women") // insert an actual product top-level category
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY2, "Bottoms") // if it is possible to drill down the categories (e.g. Apparel, then T-shirt, then Men), use item_category3, etc. Can use from item_category up to item_category5
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY3, "Leggings")
- putString(FirebaseAnalytics.Param.ITEM_CATEGORY4, "")
- putString(FirebaseAnalytics.Param.ITEM_VARIANT, "Gravel/Pristine") // insert an actual product variant - in our case the color
- putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, "womens-fdm4") // insert the name of the list where the product is currently displayed
- putLong(FirebaseAnalytics.Param.INDEX, 2) // insert product's position in that list
- putLong(FirebaseAnalytics.Param.QUANTITY, 1) // product quantity. In case of view_item_list, it will usually be equal to 1
- })
- // name of the event. In this case, it always must be view_item_list, each time new products are loaded to the screen from the list, a new event is firing with the items array being the new item batch that just loaded
- firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM_LIST) {
- param(FirebaseAnalytics.Param.ITEMS, items) // an array where all currently viewed products must be included
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement