Skip to content

E-Commerce Event Objects

Every Content Block have some respective event objects that are required by the events to be used. These event objects can be referred to as item properties for that event or model/data classes that are required for that event. These objects provide a detailed context to the event about the element they are associated with.

List of Objects

Here's a list of objects that are required in core module events.

Object Name Usability Description
Item Object items Track the items associated to e-commerce.
Item Type Object item_type_list Track the items associated to e-commerce but with min context
Coordinates Object coordinates Track the lat and lng for the coordinates related values.
Item Info Object item_info_list Track the items associated to e-commerce for verification event.
Store Object store Track the values regarding store information for item report.
Report Object report Track the elements regarding reporting of an item.
Subscription Object subscription Track the elements regarding subscription of an item.


Item Object

Before looking into the events that we have below, here is the following item object that will be used repeatedly in our events below.

Format

Param Usability Format Enum Values Description
id REQUIRED STRING --- Id of the Item in the event.
type REQUIRED STRING drug, blood, oxygen, medical_equipment, grocery, facility, subscription, item_verification, item_report, reward, survey, other Type of the item in question.
quantity REQUIRED FLOAT --- Quantity of the item.
price REQUIRED FLOAT --- Price of the item as (price * quantity).
currency REQUIRED STRING --- ISO provided currency code for the price and item.
stock_status OPTIONAL STRING in_stock, low_stock, out_of_stock Current stock status of the item.
promo_id OPTIONAL STRING --- Promo Id if any assigned to the item.
discount OPTIONAL FLOAT --- Discount percentage for the item i.e. 0.15 for 15%
facility_id OPTIONAL STRING --- facility Id if any available for the item.
subscription OPTIONAL OBJECT SUBSCRIPTION OBJECT --- facility Id if any available for the item.

Usage

     val itemModel = ItemModel(
        id = "testItemId", 
        quantity = 10, 
        price = 1900F, 
        currency = CurrencyCode.USD.name, 
        type = ItemType.drug.name,
        facility_id: "testFacilityId",
    )
    let itemDetail = {
        id: "itemId",
        type: ItemType.Drug,
        quantity: 1,
        price: 1.45,
        currency: CurrencyCode.EUR,
        stock_status: StockStatus.InStock,
        promo_id: "testPromoId",
        facility_id: "testFacilityId",
    }
    let itemDetail = {
        id: "itemId",
        type: ItemType.Drug,
        quantity: 1,
        price: 1.45,
        currency: CurrencyCode.EUR,
        stock_status: StockStatus.InStock,
        promo_id: "testPromoId",
    }
{
  "item": {
    "id": "TestItemId",
    "type": "drug",
    "quantity": 1,
    "price": 200.0,
    "currency": "EUR",
    "promo_id": "",
    "stock_status": "in_stock"
  }
}


Item Type Object

Before looking into the events that we have below, here is the following item type object that will be used repeatedly in our events below, especially in cancel checkout. This is to be used in places where we don't require all the details about the item.

Format

Param Usability Format Enum Values Description
id REQUIRED STRING --- Id of the Item in the event.
type REQUIRED STRING drug, blood, oxygen, medical_equipment, grocery, facility, subscription, item_verification, item_report, reward, survey, other Type of the item.
facility_id OPTIONAL STRING --- facility Id if any available for the item.

Usage

    val itemMinModel = ItemTypeModel(
        id = "ItemID1", 
        type = ItemType.drug.name,
        facility_id: "testFacilityId",
    )
    let itemTypeModel = {
          id: "itemId1",
          type: ItemType.Drug,
          facility_id: "testFacilityId",
    }
    let itemTypeModel = {
          id: "itemId1",
          type: ItemType.Drug
    }
{
  "item": {
    "id": "TestItemId",
    "type": "drug"
  }
}


Coordinates Object

To Log Coordinates related values for places where you need to provide Latitude and Longitude values.

Format

Param Usability Format Description
lat REQUIRED DOUBLE Latitude value.
lon REQUIRED DOUBLE Longitude Value.

Usage

    val coordinatesObject = CoordinatesObject(
        lat = 4.5123123, 
        lon = 6.7123123
    )
    let coordinatesObject = {
        lat: 4.5123123,
        lon: 6.7123123
    }
    let coordinatesObject = {
        lat: 4.5123123,
        lon: 6.7123123
    }
{
  "delivery_coordinates": {
    "lat": 4.5123123,
    "lon": 6.7123123
  }
}


Item Info Object

Before looking into the events that we have below, here is the following item info object that will be used repeatedly in our events below, especially in Item Verification event.

Format

Param Usability Format Enum Values Description
id REQUIRED STRING --- Id of the item in question.
type REQUIRED STRING drug, blood, oxygen, medical_equipment, grocery, facility, subscription, item_verification, item_report, reward, survey, other Type of the item in question.
batch_id OPTIONAL STRING --- Batch Id for the item.
survey_id OPTIONAL STRING --- Survey Id for the item.
reward_id OPTIONAL STRING --- Reward Id for the item.
is_featured OPTIONAL BOOLEAN --- If the Item is a featured item.
production_date OPTIONAL LONG --- Production Date for the item. (Time in Millis)
expiry_date OPTIONAL LONG --- Expiry Date for the item. (Time in Millis)

Usage

    val itemInfoObject = ItemInfoObject(
        id = "ItemId",
        type = ItemType.drug.name,
        batch_id = "batch000",
        survey_id = "survey_id0",
        reward_id = "reward_id0",
        is_featured = false,
        production_date = 1680788331012,
        expiry_date = 1780788331012,
    )
    let itemInfoProperties = {
        id: "testItemId",
        type: ItemType.Grocery,
        batch_id: "2134",
        survey_id: "9876",
        reward_id: "4455",
        is_featured: true,
        production_date: 1680788331012,
        expiry_date: 1780788331012
    }
    let itemInfoProperties = {
        id: "testItemId",
        type: ItemType.Grocery,
        batch_id: "2134",
        survey_id: "9876",
        reward_id: "4455",
        is_featured: true,
        production_date: 1680788331012,
        expiry_date: 1780788331012
    }
{
  "item_info": {
    "id": "TestItemId",
    "type": "drug",
    "batch_id": "TestBatchId",
    "survey_id": "TestSurveyId",
    "reward_id": "TestRewardId",
    "is_featured": false,
    "production_date": 1680771249790,
    "expiry_date": 1789771249790
  }
}


Store Object

Before looking into the events that we have below, here is the following store object that will be used repeatedly in our events below, especially in Item Report event.

Format

Param Usability Format Enum Values Description
id REQUIRED STRING --- Id of the store/shop in the event.
lat OPTIONAL FLOAT --- Latitude of the store/shop in the event.
lon OPTIONAL FLOAT --- Longitude of the store/shop in the event.

Usage

    val storeObject = StoreObject(
        id = "storeId", 
        lat = 37.648057f, 
        long = -122.443528f
    )
    let storeObject = {
        id: "storeId",
        lat = 37.648057, 
        long = -122.443528
    }
    let storeObject = {
        id: "storeId",
        lat = 37.648057, 
        long = -122.443528
    }
{
  "store_info": {
    "id": "TestStoreId",
    "lat": 37.648057, 
    "lon": -122.443528
  }
}


Report Object

Before looking into the events that we have below, here is the following report object that will be used repeatedly in our events below, especially in Item Report event.

Format

Param Usability Format Enum Values Description
id REQUIRED STRING --- Id of the report in the event.
short_desc REQUIRED STRING --- Short Description/title for the report in the event.
remarks OPTIONAL STRING --- Remarks for the report in the event.

Usage

    val reportObject = ReportObject(
        id = "reportId", 
        short_desc = "short  Value", 
        remarks = "large Value"
    )
    let reportObject = {
        id: "TestReportId",
        short_desc: "order",
        remarks: "took too long",
    }
    let reportObject = {
        id: "TestReportId",
        short_desc: "order",
        remarks: "took too long",
    }
{
  "report_info": {
    "id": "TestReportId",
    "short_desc": "Some Text",
    "remarks": "Some Text"
  }
}


Subscription Object

Subscription Object is to be use d in the item object when there is an item type as subscription.

Format

Param Usability Format Enum Values Description
status REQUIRED STRING active, inactive, paused, other Status of the subscription.
type REQUIRED STRING pay_as_you_sell, pay_as_you_go, other Type of the subscription user selected.
subscription_items OPTIONAL ARRAY (ITEM TYPE OBJECT) --- list of items/products included in the event.

Usage

    val subscriptionObject = SubscriptionObject(
        status = SubscriptionStatus.Active.toString(),
        type = SubscriptionType.PayAsYouGo.toString(),
        subscriptionItems = arrayListOf(itemTypeModel)
    )
    let subscription = {
        status: SubscriptionStatus.Active,
        type: SubscriptionType.PayAsYouGo,
        subscription_items: [
            {
                id: "hello world",
                type: ItemType.Drug
            }
        ],
    }
     let itemSubscriptionObject = {
        id: "testItemId",
        type: ItemType.Subscription,
        quantity: 1,
        price: 11,
        currency: CurrencyCode.USD,
        stock_status: StockStatus.InStock,
        promo_id: "",
        subscription: {
            status: SubscriptionStatus.Other,
            type: SubscriptionType.Other,
            subscription_items: [
                {
                    id:"test Drug ID",
                    type:ItemType.Drug
                }
            ]
        }
    }

    let itemProps = {
        action: ItemAction.TopUp,
        item: itemSubscriptionObject
    }

    CfECommerce.logItemEvent(itemProps)
{
    "type":"item",
    "props":{
        "action":"view",
        "item":{
            "id":"TestItemId",
            "type":"subscription",
            "quantity":1,
            "price":200.0,
            "currency":"EUR",
            "promo_id":"",
            "stock_status":"in_stock",
            "subscription":{
                "status":"active",
                "type":"pay_as_you_sell",
                "subcription_items":[
                    {
                        "id":"TestItemId1",
                        "type":"drug"
                    },
                    {
                        "id":"TestItemId2",
                        "type":"drug"
                    }
                ]
            }
        }
    }
}