Package 

Class BsLogCartEvent.Builder


  • 
    public final class BsLogCartEvent.Builder
    
                        

    BsLogCartEvent 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.

    • Method Detail

      • 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.

      • setItemCurrency

         final <ERROR CLASS> setItemCurrency(CurrencyCode 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.

      • 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.

      • 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.

      • setCurrency

         final <ERROR CLASS> setCurrency(CurrencyCode 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.