Tracking the content of the basket

How to track and send the content of the basket

Jan Tlapak avatar
Written by Jan Tlapak
Updated over a week ago

If you want to use the content of the basket in your automations, ie products placed in the basket, then you must always send the current content of the basket to Ecomail. That is, an event after adding or removing a product from the basket.

You can use the tracking code or our API to send the content of the basket.

In both cases, it is necessary to know the email address of the users first to save the data accordingly to their profile. In the case of a tracking code, the user is tracked after clicking in the newsletter or using manual tracking. If you use the API, an email is sent along with the request.

Tracking code variant:

Just send a special trackUnstructEvent event like this:

window.ecotrack('trackUnstructEvent', {
schema: '',
data: {
action: 'Basket',
products: [{
productId: 1,
img_url: '',
url: '',
name: 'My product 1',
price: 1,
description: 'Description of my product'

Due to the size limit of the cookies in the case of a tracking code, we recommend that you first test the number of products in the basket and the possible introduction of a limit (eg 10 products). If it is common for your process for a user to add a large number of products to the basket, we recommend using API variant.

API variant

  • email - must contain the email of the contact to whom the event is assigned

  • category - must contain the value ue

  • action - must contain the Basket value

  • label - must contain Basket value

  • value - must contain the data structure (escaped json) see example below

The request is sent to this endpoint in the following form:

"event": {
"email": "",
"category": "ue",
"action": "Basket",
"label": "Basket",
"value": "{\"data\":{\"data\":{\"action\":\"Basket\",\"products\":[{\"productId\":1,\"img_url\":\"\",\"url\": \"\",\"name\": \"My product 1\",\"price\": 1,\"description\":\"Description of my product\"}]}}}"

In both cases, it is necessary to send also an empty basket, ie after removing the product(s). As soon as there is an empty basket in Ecomail as the last information, the email will not be sent in the automation of the abandoned basket.

In the email template, you can then parse the last content of their basket into the email for the user using special merge tags. You can read how to prepare a template for an abandoned basket here.

If you have any further questions, you can contact us at


Did this answer your question?