-
public final class BsLogCartEvent.BuilderBsLogCartEvent is used to log the events related to cart. You can use this event to log when an item was added or removed form the cart.
-
-
Field Summary
Fields Modifier and Type Field Description private Stringcart_idprivate Stringcart_actionprivate ItemModelitem_valueprivate Floatcart_priceprivate Stringcurrency_value
-
Constructor Summary
Constructors Constructor Description BsLogCartEvent.Builder(Context context, String cart_id, String cart_action, ItemModel item_value, String item_id, Integer item_quantity, Float item_price, String item_currency, String item_type, String item_stockStatus, String item_promoId, Float cart_price, String currency_value, Object meta, Boolean update_immediately)
-
Method Summary
Modifier and Type Method Description final StringgetCart_id()final UnitsetCart_id(String cart_id)final StringgetCart_action()final UnitsetCart_action(String cart_action)final ItemModelgetItem_value()final UnitsetItem_value(ItemModel item_value)final FloatgetCart_price()final UnitsetCart_price(Float cart_price)final StringgetCurrency_value()final UnitsetCurrency_value(String currency_value)final <ERROR CLASS>init(Context context)init is required to pass context to the SDK method and log the event. final <ERROR CLASS>setCartId(String cart_id)setCartId can be used to log the cartId the event is logged for. final <ERROR CLASS>setCartAction(CartAction cart_action)setCartAction is required to pass the actions for cart the logged is triggered on. final <ERROR CLASS>setCartAction(String cart_action)setCartAction is required to pass the actions for cart the logged is triggered on. final <ERROR CLASS>setItemId(String item_id)setItemId is required to log the Id for item the events are being logged. final <ERROR CLASS>setItemQuantity(Integer item_quantity)setItemQuantity is required to log the quantity for item the events are being logged. final <ERROR CLASS>setItemPrice(Float item_price)setItemPrice is required to log the price for item the events are being logged. final <ERROR CLASS>setItemPrice(Integer item_price)final <ERROR CLASS>setItemPrice(Double item_price)final <ERROR CLASS>setItemCurrency(String currency_code)setItemCurrency is required to log the currency for item the events are being logged. final <ERROR CLASS>setItemType(ItemType item_type)setItemType is required to log the type for item the events are being logged. final <ERROR CLASS>setItemType(String item_type)final <ERROR CLASS>setItemStockStatus(ItemStockStatus stock_status)setItemStockStatus is required to log the stock status for item the events are being logged. final <ERROR CLASS>setItemStockStatus(String stock_status)final <ERROR CLASS>setItemPromoId(String promo_id)setItemPromoId is required to log the promo Id for item the events are being logged. final <ERROR CLASS>setItem(ItemModel item)setItem can be used to pass the whole item as an object as well. final <ERROR CLASS>setItem(String itemJsonString)setItem can be used to pass the whole item as a Json String object as well. final <ERROR CLASS>setCartPrice(Integer cart_price)setCartPrice is required to log the total price for cart being logged. final <ERROR CLASS>setCartPrice(Float cart_price)final <ERROR CLASS>setCartPrice(Double cart_price)final <ERROR CLASS>setCurrency(String currency_code)setCurrency is required to log the currency for cart price being logged. final <ERROR CLASS>setMeta(Object meta)You can pass any type of value in setMeta. final <ERROR CLASS>updateImmediately(Boolean update_immediately)updateImmediately is responsible for updating the values ot the backend immediately. final <ERROR CLASS>build()build will validate all of the values provided and if passes will call the track function and queue the events based on it's updateImmediately value and also on the user's network resources. -
-
Constructor Detail
-
BsLogCartEvent.Builder
BsLogCartEvent.Builder(Context context, String cart_id, String cart_action, ItemModel item_value, String item_id, Integer item_quantity, Float item_price, String item_currency, String item_type, String item_stockStatus, String item_promoId, Float cart_price, String currency_value, Object meta, Boolean update_immediately)
-
-
Method Detail
-
getCart_id
final String getCart_id()
-
setCart_id
final Unit setCart_id(String cart_id)
-
getCart_action
final String getCart_action()
-
setCart_action
final Unit setCart_action(String cart_action)
-
getItem_value
final ItemModel getItem_value()
-
setItem_value
final Unit setItem_value(ItemModel item_value)
-
getCart_price
final Float getCart_price()
-
setCart_price
final Unit setCart_price(Float cart_price)
-
getCurrency_value
final String getCurrency_value()
-
setCurrency_value
final Unit setCurrency_value(String currency_value)
-
init
final <ERROR CLASS> init(Context context)
init is required to pass context to the SDK method and log the event. if not provided, it will throw an exception on runtime.
-
setCartId
final <ERROR CLASS> setCartId(String cart_id)
setCartId can be used to log the cartId the event is logged for. It is recommended to include the unique cartId for the cart items so that they can be tracked.
-
setCartAction
final <ERROR CLASS> setCartAction(CartAction cart_action)
setCartAction is required to pass the actions for cart the logged is triggered on. By default the SDK provides 2 main list actions for e-commerce apps. Which includes addItem and removeItem setCartAction provides 2 approaches for logging list events, one is with enums and the other is with string. Below is the function to log cartAction event using enum type.
-
setCartAction
final <ERROR CLASS> setCartAction(String cart_action)
setCartAction is required to pass the actions for cart the logged is triggered on. By default the SDK provides 2 main list actions for e-commerce apps. Which includes addItem and removeItem. setCartAction provides 2 approaches for logging list events, one is with enums and the other is with string. Below is the function to log listAction event using string type. Remember to note that with string type, you need to pass the values as provided in the enum or else the events will be discarded
-
setItemId
final <ERROR CLASS> setItemId(String item_id)
setItemId is required to log the Id for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemQuantity
final <ERROR CLASS> setItemQuantity(Integer item_quantity)
setItemQuantity is required to log the quantity for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemPrice
final <ERROR CLASS> setItemPrice(Float item_price)
setItemPrice is required to log the price for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemPrice
final <ERROR CLASS> setItemPrice(Integer item_price)
-
setItemPrice
final <ERROR CLASS> setItemPrice(Double item_price)
-
setItemCurrency
final <ERROR CLASS> setItemCurrency(String currency_code)
setItemCurrency is required to log the currency for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemType
final <ERROR CLASS> setItemType(ItemType item_type)
setItemType is required to log the type for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemType
final <ERROR CLASS> setItemType(String item_type)
-
setItemStockStatus
final <ERROR CLASS> setItemStockStatus(ItemStockStatus stock_status)
setItemStockStatus is required to log the stock status for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item.
-
setItemStockStatus
final <ERROR CLASS> setItemStockStatus(String stock_status)
-
setItemPromoId
final <ERROR CLASS> setItemPromoId(String promo_id)
setItemPromoId is required to log the promo Id for item the events are being logged. Details about the item are to be provided in the catalog for more details about the item. If there is not promo associated with the product, you do not need to pass it.
-
setItem
final <ERROR CLASS> setItem(ItemModel item)
setItem can be used to pass the whole item as an object as well. You can use the POJO ItemModel to parse the data int he required format and pass that to this function to log the event.
-
setItem
final <ERROR CLASS> setItem(String itemJsonString)
setItem can be used to pass the whole item as a Json String object as well. You can use the POJO ItemModel to parse the data int he required format and pass that to this function as a string to log the event. You can use Gson to convert the object to string but SDK will parse the Json string back to POJO so pass it in the log. This method should be used with caution and is suitable for react native bridge.
-
setCartPrice
final <ERROR CLASS> setCartPrice(Integer cart_price)
setCartPrice is required to log the total price for cart being logged. Details about the cart are to be provided in the catalog.
-
setCartPrice
final <ERROR CLASS> setCartPrice(Float cart_price)
-
setCartPrice
final <ERROR CLASS> setCartPrice(Double cart_price)
-
setCurrency
final <ERROR CLASS> setCurrency(String currency_code)
setCurrency is required to log the currency for cart price being logged. Details about the cart are to be provided in the catalog.
-
setMeta
final <ERROR CLASS> setMeta(Object meta)
You can pass any type of value in setMeta. It is for developer and partners to log additional information with the log that they find would be helpful for logging and providing more context to the log. Default value for the meta is null.
-
updateImmediately
final <ERROR CLASS> updateImmediately(Boolean update_immediately)
updateImmediately is responsible for updating the values ot the backend immediately. By default this is set to false or whatever the developer has set in the SDK initialisation block. This differs the time for which the logs will be logged, if true, the SDK will log the content instantly and if false it will wait till the end of user session which is whenever the app goes into background.
-
build
final <ERROR CLASS> build()
build will validate all of the values provided and if passes will call the track function and queue the events based on it's updateImmediately value and also on the user's network resources.
-
-
-
-