Skip to navigation

eCommerce tracker events

View as Markdown

Tracker events help you learn more about your customers by analysing how they interact with your marketing initiatives. This lets your eCommerce business automate sales processes and track customer-interaction metrics. This guide covers the integration between eCommerce and the frontend tracker events.

Integration with plugins

For steps to integrate the eCommerce API with various plugins, see the help articles. For Shopify, see this article.

How cart and order events are processed

How Brevo processes an event depends on the endpoint you send it to:

EventSent withProcessed as
cart_updated, cart_deletedThe Brevo tracker (Brevo.push(["track", ...])) or the trackEvent endpoint, with the ecommerce app activatedEcommerce event. Triggers ecommerce automations such as abandoned cart.
cart_updated, cart_deletedCreate an event (POST /v3/events)Custom event. Does not trigger ecommerce automations.
order_completedAny tracker or events endpointCustom event
OrdersManaging the status of the order or Create orders in batchEcommerce order (order_created)

Cart event payloads

Cart events use the same structure whether you send them with the tracker or the REST endpoint:

  • event: the event name (cart_updated or cart_deleted)
  • properties: contact attributes to update, such as FIRSTNAME
  • eventdata.id: a unique ID for the cart, for example cart:1234. Use the same ID for every event about the same cart.
  • eventdata.data: the cart details described below

Brevo stores the fields of eventdata.data as the event’s properties, together with eventdata.id as id. Brevo doesn’t validate these fields, but ecommerce features such as email templates, segmentation and product recommendations read them using the names and types below.

cart_updated

Send cart_updated every time the cart is created or changed, with the full current content of the cart.

Brevo.push([
"track",
"cart_updated",
{ "email": "jane.doe@example.com", "FIRSTNAME": "Jane" },
{
"id": "cart:1234",
"data": {
"url": "https://shop.example.com/cart",
"currency": "EUR",
"subtotal": 180.00,
"discount": 10.00,
"shipping": 5.00,
"tax": 29.17,
"total_before_tax": 145.83,
"total": 175.00,
"items": [
{
"id": 101,
"variant_id": 1011,
"name": "Black shoes",
"variant_name": "Size 42",
"sku": "SH-BLK-42",
"category": "Shoes",
"quantity": 2,
"price": 90.00,
"url": "https://shop.example.com/products/black-shoes",
"image": "https://shop.example.com/images/black-shoes.jpg"
}
]
}
}
]);
FieldTypeDescription
urlStringLink back to the cart, used in cart recovery emails
currencyStringISO 4217 currency code, for example EUR
subtotalNumberTotal of the items before discount, shipping and tax
discountNumberTotal discount applied to the cart
shippingNumberShipping cost
taxNumberTotal tax
total_before_taxNumberCart total excluding tax
totalNumberFinal cart total
itemsArrayProducts in the cart
items[].idNumberProduct ID. Product recommendations only use numeric IDs.
items[].variant_idNumber or stringProduct variant ID
items[].nameStringProduct name
items[].variant_nameStringVariant name, for example a size or color
items[].skuStringProduct SKU
items[].categoryStringProduct category
items[].quantityNumberQuantity in the cart
items[].priceNumberUnit price of the product
items[].urlStringProduct page URL
items[].imageStringProduct image URL

Send amounts as numbers rather than strings.

cart_deleted

Send cart_deleted when the cart is emptied or removed. Only the cart ID is needed:

{
"email": "jane.doe@example.com",
"event": "cart_deleted",
"eventdata": { "id": "cart:1234" }
}

Purchases

Record each purchase with Managing the status of the order. Brevo stores it as an order_created ecommerce event, which ecommerce automations use to detect purchases.

Each call to this endpoint is stored as a new order_created event, whatever the status, including a status change such as cancelled or refunded. A workflow that starts when a contact places an order and lets contacts enter again can therefore start again for each status change of the same order. Send status changes only when you need them, or don’t let contacts enter that workflow again.

You can also send an order_completed event with the tracker, for example when a workflow uses it as an exit condition. Brevo stores order_completed as a custom event, and its eventdata.data fields are stored under data. (for example data.total).

Session data of orders

When a user logs in and browses the store, they start a session that persists for the duration of their visit. Without logins or users, there is no session data. The order is automatically updated if an identify call is made on the frontend for the same email. Some frontend data fields for a given event are listed below.


created_at: 10-04-2023 12:09:47
email_id: email.id+newdemo@gmail.com
ip_address: xxx.xxx.xxx.xxx
session_city: Delhi
session_country: India
session_country_code: IN
session_current_url: https://sample-store.myshopify.com/
session_id: aafb3231-1ead-4d96-8d9b-7d78234701bb
session_latitude: 00.0000
session_longitude: 00.0000
session_referer: sample-store.myshopify.com
session_referer_url: https://sample-store.myshopify.com/account/register
session_region: Delhi
session_source: sample-store.myshopify.com
session_timezone: Asia
session_user_agent_browser: Chrome
session_user_agent_device: DESKTOP
session_user_agent_platform: Mac
session_user_agent_version: 112.0.0.0
sib_type: identify
visitor_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

View the session data for orders in your Brevo account under the Automation logs. Any change to the cart appears in the Automation logs in your Brevo account. You can retrieve data such as session_id, session_timezone, and session_city.

Cart events and Automation

Once the cart is used, all session data, frontend events, and data appear in your Automation tab logs. The plugin is responsible for sending the data to Automation. If the plugin is integrated correctly, the store session is identified, the order is processed quickly, and it appears on the logs page. If the identify call does not arrive on the frontend, it takes about 5 minutes for the order or cart updates to appear in the Automation logs.