Plugin events
Future Ordering UI emits events when user performs certain actions. These events can be listened to by plugins.
Listening for events
export default async context => {
context.statisticsEventHandler.addEventListener((event: StatisticsEvent) => {
// handle event
});
};
Each event has a name property that identifies the event type. You can use this to filter for specific events:
export default async context => {
context.statisticsEventHandler.addEventListener((event: StatisticsEvent) => {
if (event.name === 'userEvent' && event.eventLabel === 'Created Account') {
// user has created an account
}
});
};
General events
Country changed
Emitted when the user changes their selected country.
Event name: countryChanged
| Property | Type | Description |
|---|---|---|
eventLabel | string | The country that was selected |
User authenticated
Emitted when a user's authentication state changes.
Event name: userAuthenticated
| Property | Type | Description |
|---|---|---|
customDimensionIndex | number | Index of the custom dimension |
customDimensionValue | string (optional) | The user identifier |
userLoggedIn | boolean | true if the user is logged in, false if guest |
email | string (optional) | The user's email address |
phoneNumber | string (optional) | The user's phone number in local country format without country code |
countryCode | string | The user's country code |
User event
Event name: userEvent
Emitted when a user creates an account, logs in, or logs out.
| Property | Type | Description |
|---|---|---|
eventLabel | string | The action performed. One of Created Account, Logged In, or Logged Out |
userId | string | The user's identifier |
countryCode | string | The user's country code |
cultureCode | string | The user's culture code |
Localization changed
Emitted when the user changes their language or locale.
Event name: localizationChanged
| Property | Type | Description |
|---|---|---|
eventLabel | string | The localization that was selected |
Page changed
Emitted when the user navigates to a different page.
Event name: pageChanged
| Property | Type | Description |
|---|---|---|
page | string | The current page pathname and query string |
pageType | string | The type of page, for example product-list, category-list, dashboard, or countries |
previousPage | string | The previous page pathname and query string |
orderType | string | The current order type, for example eatin, takeaway, kioskeatin, or kiosktakeaway |
countryCode | string | The country code |
Start session
Emitted when a new user session begins.
Event name: startSession
This event has no additional properties.
End session
Emitted when the current user session ends.
Event name: endSession
This event has no additional properties.
Order events
Order cancel
Emitted when the user cancels their current order.
Event name: orderCancel
This event has no additional properties.
Order type selected
Emitted when the user selects an order type.
Event name: orderTypeSelected
| Property | Type | Description |
|---|---|---|
orderType | string | The order type that was selected, for example eatin, takeaway, kioskeatin, or kiosktakeaway |
Order created
Emitted when an order has been successfully created.
Event name: orderCreated
Contains an orderInfo object with the following properties:
| Property | Type | Description |
|---|---|---|
orderInfo.storeId | number | The store identifier |
orderInfo.storeName | string | The store name |
orderInfo.orderId | string | The order identifier |
orderInfo.salesChannelType | string | The sales channel. One of browser, kiosk, mobileApp, or external |
orderInfo.deviceId | string | The device identifier |
orderInfo.menuType | string | The menu type, for example eatin, takeaway, kioskeatin, or kiosktakeaway |
orderInfo.country | string | The country |
Order cleared
Emitted when the current order is cleared.
Event name: orderCleared
| Property | Type | Description |
|---|---|---|
orderId | string | The order identifier |
Payment events
Payment save method
Emitted when the user has been prompted to save a payment method and make a choice.
Event name: paymentSaveMethod
| Property | Type | Description |
|---|---|---|
eventLabel | string | Whether the user chose to save the method. Yes or No |
paymentMethod.provider | string | The payment provider |
paymentMethod.paymentMethodType | string | The payment method type |
paymentMethod.expiryDate | string | The expiry date of the payment method |
Payment method added
Emitted when the user adds a new payment method.
Event name: paymentMethodAdded
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the payment method |
expiryDate | string | The expiry date of the payment method |
Payment method removed
Emitted when the user removes a saved payment method.
Event name: paymentMethodRemoved
| Property | Type | Description |
|---|---|---|
eventLabel | string | The payment provider, for example adyen |
Favorite events
Favorite product added
Emitted when the user adds a product to a favorite order.
Event name: favoriteProductAdded
| Property | Type | Description |
|---|---|---|
favoriteOrderId | string | The favorite order identifier |
product | object | The product that was added. See Product data |
Favorite order added
Emitted when the user saves an order as a favorite.
Event name: favoriteOrderAdded
| Property | Type | Description |
|---|---|---|
favoriteOrderId | string | The favorite order identifier |
products | object[] | The products in the order. See Product data |
Favorite order removed
Emitted when the user removes a saved favorite order.
Event name: favoriteOrderRemoved
| Property | Type | Description |
|---|---|---|
favoriteOrderId | string | The favorite order identifier |
products | object[] | The products in the order. See Product data |
Category & navigation events
Category clicked
Emitted when the user clicks on a menu category.
Event name: categoryClick
| Property | Type | Description |
|---|---|---|
eventLabel | string | The category name |
eventValue | string | The category identifier |
Sub-category expanded
Emitted when the user expands a sub-category in the menu.
Event name: menuSubCategoryExpanded
| Property | Type | Description |
|---|---|---|
eventLabel | string | The sub-category name |
eventValue | number | The sub-category identifier |
Store selected
Emitted when the user selects a store.
Event name: storeSelected
| Property | Type | Description |
|---|---|---|
storeId | number | The store identifier |
storeName | string | The store name |
Time selected
Emitted when the user selects a pickup or delivery time.
Event name: timeSelected
| Property | Type | Description |
|---|---|---|
eventLabel | string | The time selection type. datetime or datetime-blocks |
dimension4 | string | Whether the time is direct or future. direct or future |
Ecommerce events
Products impression
Emitted when products are displayed to the user.
Event name: productsImpression
| Property | Type | Description |
|---|---|---|
ecommerce.countryCode | string | The country code |
ecommerce.currencyCode | string | The currency code |
ecommerce.impressions | object[] | The products shown. See Product data |
Product click
Emitted when the user clicks on a product.
Event name: productClick
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the product |
ecommerce.countryCode | string | The country code |
ecommerce.click.actionField.list | string | The list the product was in |
ecommerce.click.products | object[] | The products clicked. See Product data |
Product detail
Emitted when the user views a product's detail page.
Event name: productDetail
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the product |
ecommerce.countryCode | string | The country code |
ecommerce.detail.actionField.list | string | The list the product was in |
ecommerce.detail.products | object[] | The products viewed. See Product data |
Add to cart
Emitted when a product is added to the cart.
Event name: addToCart
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the product |
ecommerce.countryCode | string | The country code |
ecommerce.currencyCode | string | The currency code |
ecommerce.cultureCode | string (optional) | The culture code |
ecommerce.sourceProductMenuId | number (optional) | The source product menu identifier |
ecommerce.add.products | object[] | The products added. See Product data |
Remove from cart
Emitted when a product is removed from the cart.
Event name: removeFromCart
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the product |
ecommerce.countryCode | string | The country code |
ecommerce.remove.products | object[] | The products removed. See Product data |
Checkout
Emitted when the user proceeds to checkout.
Event name: checkout
| Property | Type | Description |
|---|---|---|
eventLabel | string | Always Checkout |
ecommerce.countryCode | string | The country code |
ecommerce.currencyCode | string | The currency code |
ecommerce.checkout.products | object[] | The products in the checkout. See Product data |
Transaction
Emitted when a purchase transaction is completed.
Event name: transaction
| Property | Type | Description |
|---|---|---|
page | string | The current page |
title | string | The page title |
dimension1 | string | The order type |
dimension2 | string | The store affiliation (store name and city) |
dimension3 | string | The user identifier |
dimension4 | string | Whether the order is future or direct |
dimension5 | string | The check number |
ecommerce.countryCode | string | The country code |
ecommerce.currencyCode | string | The currency code |
ecommerce.purchase.actionField.id | string | The transaction identifier |
ecommerce.purchase.actionField.affiliation | string | The store affiliation (store name and city) |
ecommerce.purchase.actionField.storeCity | string | The store city |
ecommerce.purchase.actionField.revenue | string | The total revenue |
ecommerce.purchase.actionField.tax | string | The tax amount |
ecommerce.purchase.actionField.shipping | string | The shipping cost |
ecommerce.purchase.storeId | string | The store identifier |
ecommerce.purchase.pickupTime | string | The pickup time |
ecommerce.purchase.provider | string | The payment provider, for example adyen |
ecommerce.purchase.products | object[] | The products purchased. See Product data |
ecommerce.purchase.collectionType | string (optional) | The collection type |
ecommerce.purchase.paymentMethodType | string (optional) | The payment method type |
Basket quantity changed
Emitted when the quantity of a product in the basket is changed.
Event name: basketQuantityChanged
| Property | Type | Description |
|---|---|---|
eventLabel | string | Label describing the change |
ecommerce.countryCode | string | The country code |
ecommerce.change.products | object[] | The products changed. See Product data |
Product data
Several events include product data. Each product object has the following properties:
| Property | Type | Description |
|---|---|---|
name | string | The product name |
id | number | The product identifier |
price | number | The product price |
category | string | The product category |
quantity | number (optional) | The quantity |
list | string (optional) | The list the product belongs to |