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
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
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
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
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
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
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
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"
}
]
}
}
}
}