Use order events to capture customer interactions with ecommerce orders in your mobile application, such as purchases, cancellations, returns, and order status changes. These events help you understand customer purchasing behavior and order management patterns.
Event Structure
All order events require an order with these fields:
| Field Name | Field Type | Required | Description |
|---|---|---|---|
order |
Order Attribute | Yes | A single order attribute value. |
Event Types
The Order Event supports these interaction types:
- Purchase: Track when customers complete a purchase
- Preorder: Capture when customers place preorders
- Cancel: Track when customers cancel orders
- Ship: Monitor when orders are shipped
- Deliver: Track when orders are delivered
- Return: Capture when customers return orders
- Exchange: Track when customers exchange orders
Purchase Order Event
Track when customers complete a purchase.
PurchaseOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.purchase(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Preorder Order Event
Capture when customers place preorders.
PreOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.preorder(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Cancel Order Event
Track when customers cancel orders.
CancelOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.cancel(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Ship Order Event
Monitor when orders are shipped.
ShipOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.ship(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Deliver Order Event
Track when orders are delivered.
DeliverOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.deliver(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Return Order Event
Capture when customers return orders.
ReturnOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.returnOrder(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)
Exchange Order Event
Track when customers exchange orders.
ExchangeOrderEvent(
order: Order(
id: "order-1",
totalValue: 9.99,
currency: "USD",
attributes: [
"PROMO_CODE": "HELLO"
],
lineItems: [
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20,
currency: "USD",
attributes: [
"gift_wrap": true
]
)
]
)
)
OrderEvent.exchange(
order = Order(
id = "order-1",
totalValue = 9.99,
currency = "USD",
attributes = mapOf(
"PROMO_CODE" to "HELLO"
),
lineItems = listOf(
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)
)
)
)