Skip to main content

E-Commerce Ingest Events

Kenkai SDK E-Commerce module consists of events for online marketplace platforms. You need to implement this module if your app offers e-commerce content that may include showcasing items to purchase, logging impressions, checking out events, and also events related to delivery as well.

List of Events

Event NameTypeDescription
ItemitemTrack actions on item, views, details, or item impression in a list.
CartcartTrack changes in the cart, when an item is being added or removed.
CheckoutcheckoutTrack when an item is checkout or unable to checkout.
DeliverydeliveryTrack when an item is delivered.
Cancel Checkoutcancel_checkoutTrack when user cancels a checkout or discards a cart.
Item Reportitem_reportTrack when user reports an item.
Item Requestitem_requestTrack when user requests an item.
Item Impression ListeneritemTrack when an item is shown to the user in a list.


Item Event

To log item related events which includes when an item is viewed and when an item's detail is viewed.

Format

ParamUsabilityFormatEnum ValuesDescription
actionREQUIREDSTRINGimpression, view, detail, add_favorite, remove_favorite, add_reminder, remove_reminder, remove_reminder_auto, top_up, cancel, update, remove, add, selectAction applied on the item.
itemREQUIREDOBJECT ITEM OBJECT---Details about the item used in the event.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

    val itemModel = ItemModel(
id = "testItemId",
quantity = 10,
unitPrice = 1900.0,
currency = CurrencyCode.USD,
type = ItemType.Drug,
discount = 2.0,
stockStatus = ItemStockStatus.InStock,
promoId = "",
facilityId = "test facilityId",
)

CFEComEvent.logIngest(
EComEventType.Item,
logObject = ViewItemObject(
action = ItemAction.View,
item = itemModel
)
)


Cart Event

To log cart related events which includes when an item is added or removed from a cart.

Format

ParamUsabilityFormatEnum ValuesDescription
cart_idREQUIREDSTRING---Cart Id for the cart being modified.
actionREQUIREDSTRINGadd_item, remove_itemAction applied on the item inside the cart.
itemREQUIREDOBJECT ITEM OBJECT---Details about the item(s) used in the event.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

    CFEComEvent.logIngest(
EComEventType.Cart,
logObject = CartObject(
cartId = "testCartId",
action = CartAction.AddItem,
item = itemModel
)
)


Checkout Event

To log checkout related events which includes when an items being purchased.

Format

ParamUsabilityFormatEnum ValuesDescription
order_idREQUIREDSTRING---Order Id for the placement.
cart_idREQUIREDSTRING---Cart Id for the order being checked out.
cart_priceREQUIREDFLOAT---Total price of the cart at checkout.
shop_modeOPTIONALSTRINGdelivery, pickupshop mode selected the order, if it is a delivery based order or a pickup order.
itemsREQUIREDARRAY (ITEM OBJECT)---Details about the item(s) used in the event, all od the items in the order.
is_successfulREQUIREDBOOLEAN---If the order checked out is successful or not.
metaOPTIONALANY---Any additional value that is sent with the log.
"Meta Properties"

Some item types requires certain elements to be provided using meta properties. Please refer to your integration notes to verify which fields are required for your use-case.

Usage

     CFEComEvent.logIngest(
EComEventType.Checkout,
logObject = CheckoutObject(
orderId = "SomeOderIDddd",
cartId = "someCARTIddd",
isSuccessful = true,
cartPrice = 900.0,
shopMode = ShopMode.Pickup,
itemList = listOf(itemModel)
)
)


Delivery Event

To log delivery related events which includes when an item is delivered.

Format

ParamUsabilityFormatEnum ValuesDescription
delivery_idREQUIREDSTRING---Delivery Id for the order being delivered.
order_idREQUIREDSTRING---Order Id for the order being delivered.
actionREQUIREDSTRINGschedule, update, dispatch, deliveredAction applied on the delivery event.
is_urgentREQUIREDBOOLEAN---Is delivery event marked as urgent delivery.
est_delivery_tsOPTIONALSTRING---Estimated delivery time in ISO. ISO 8601 format.
delivery_coordinatesOPTIONALARRAY (NUMBER)---Coordinates for the place where the delivery is going to be made.
dispatch_coordinatesOPTIONALARRAY (NUMBER)---Coordinates for the place where the order is going to be dispatched from.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

    CFEComEvent.logIngest(
EComEventType.Delivery,
logObject = DeliveryObject(
deliveryId = "testDeliveryId",
orderId = "testOrderId",
action = DeliveryAction.Delivered,
isUrgent = true,
deliveryTs = System.currentTimeMillis().plus(10000),
deliveryCoordinates = CoordinatesObject(lat = 4.5, lng = 6.7),
dispatchCoordinates = CoordinatesObject(lat = 4.5, lng = 6.7)
)
)


Cancel Checkout Event

To log Cancel Checkout related events which includes when item(s) is cancelled.

Format

ParamUsabilityFormatEnum ValuesDescription
cancel_type_idREQUIREDSTRING---Order/cart Id for the order being canceled.
typeREQUIREDSTRINGcart, ordertype of the list being canceled.
items_listREQUIREDARRAY (STRING)---List of item ids being cancelled.
reasonOPTIONALSTRING---Reason for canceling.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

    logIngest(
EComEventType.CancelCheckout,
logObject = CancelCheckoutObject(
checkoutId = "testCartId",
type = CancelType.Order,
itemsList = listOf("ItemID1", "ItemID2"),
reason = "testreason"
)
)


Item Report Event

To log Item Report Event.

Format

ParamUsabilityFormatEnum ValuesDescription
item_idREQUIREDSTRING---ID for the item in report event.
item_typeREQUIREDSTRINGdrug, blood, oxygen, medical_equipment, grocery, facility, subscription, item_verification, item_report, reward, survey, otherType for the item in report event.
report_idREQUIREDSTRING---ID for the report event.
report_remarksREQUIREDSTRING---Remarks for report event.
store_idREQUIREDSTRING---Store Id in report event.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

     logIngest(
EComEventType.ItemReport,
logObject = ItemReportObject(
itemId = "itemIdTTTT",
itemType = ItemType.Drug,
reportId = "reportId",
reportRemarks = "short Value",
storeId = "storeId"
)
)


Item Request Event

To log Item Request Event.

Format

ParamUsabilityFormatEnum ValuesDescription
item_idREQUIREDSTRING---id for the request element event.
item_nameREQUIREDSTRING---Name for the item in request event.
manufacturerREQUIREDSTRING---Manufacturer name for the item in request event.
metaOPTIONALANY---Any additional value that is sent with the log.

Usage

    logIngest(
EComEventType.ItemRequest,
logObject = ItemRequestObject(
itemRequestId = "ItemRequestIdSem",
itemName = "Item Namer",
manufacturer = "Item Manufacturer conubia"
)
)


Item Impression Listener

To log when an item is shown to the user in a list, marking the impression of the item.

"Partially Auto-Tracked"

Item impression listener needs to be set up on the listviews/recyclerviews for it to start listening when the items are shown to the users.

Usage

"No Jetpack Compose Support"

Currently the Impression listener does not provide support for Jetpack Compose LazyColumn or LazyRow but for RecyclerViews (XML-based layouts) only. In order to use for Jetpack Compose, you need to create your own listener and can directly use the item event with action as impression.

    CfItemImpressionListener.trackRecyclerView(
recyclerView = binding.imageRecyclerView, // RecyclerView to which the impression listener will be attached.
currentDataProvider = {
ProductsList.map { // map your internal product list to the SDK's one to provide details about the items.
ItemImpressionModel(
itemProperties = ItemModel(
id = it.itemId,
quantity = it.quantity,
price = (it.quantity * it.price),
currency = CurrencyCode.IDR.name,
type = ItemType.drug.name,
stockStatus = ItemStockStatus.in_stock.name,
promoId = "testPromoId"
),
catalogProperties = DrugCatalogModel(
market_id = "id",
name = "MedName",
description = "",
supplier_id = "SupplierId",
supplier_name = "SupplierName",
producer = "",
packaging = "",
active_ingredients = [paracetamol],
drug_form = "otc",
drug_strength = "",
atc_anatomical_group = "",
otc_or_ethical = "otc"
)
)
}
}
)