The added product to cart
event is a key e-commerce tracking action. It should be triggered each time a user adds a product to the online shopping cart.
Unlocked Features
- Cart abandonment workflow: Streamlines the process of re-engaging customers who have left items in their cart without completing the purchase. See the Cart abandonment guide for more information.
- Contact segmentation: Enables targeted communication by categorizing contacts based on specific criteria.
Supported Endpoints
Endpoint | eventVersion | origin |
---|---|---|
/v5/events (Events API) | "" (empty) | api |
track (JavaScript API) | "" (empty) | api |
We recommend to send this event via JavaScript API
Example event
Below is an example event provided for testing. You can send this through the available endpoints to evaluate automation, segmentation, or any other custom functionalities.
JavaScript API:
omnisend.push([
"track",
"added product to cart",
{
"origin": "api",
"eventID": "f3f61bc6-07b8-4645-92d8-189d882dbcb1",
"eventVersion": "",
"eventTime": "2021-07-01T00:00:00Z",
"properties": {
"abandonedCheckoutURL": "https://example.com/checkout",
"cartID": "a342-dsfv12",
"currency": "EUR",
"lineItems": [
{
"productCategories": [
{
"id": "123",
"title": "Shoes"
}
],
"productDescription": "The best product with many various features",
"productDiscount": 10,
"productID": "1",
"productImageURL": "https://example.com/product/232423-image.jpg",
"productPrice": 19.99,
"productQuantity": 2,
"productSKU": 200,
"productStrikeThroughPrice": 29.99,
"productTitle": "The best product",
"productURL": "https://example.com/product/232423",
"productVariantID": "123",
"productVariantImageURL": "https://example.com/product/232423-variant-image.jpg"
}
],
"addedItem": {
"productCategories": [
{
"id": "123",
"title": "The best product"
}
],
"productDescription": "The best product with many various features",
"productDiscount": 10,
"productID": "1",
"productImageURL": "https://example.com/product/232423-image.jpg",
"productPrice": 19.99,
"productQuantity": 2,
"productSKU": 200,
"productStrikeThroughPrice": 29.99,
"productTitle": "The best product",
"productURL": "https://example.com/product/232423",
"productVariantID": "123",
"productVariantImageURL": "https://example.com/product/232423-variant-image.jpg"
},
"value": 19.99
}
}
]);
Events API:
POST /v5/events
Host: api.omnisend.com
Content-Type: application/json
{
"eventName": "added product to cart",
"origin": "api",
"eventID": "f3f61bc6-07b8-4645-92d8-189d882dbcb1",
"eventVersion": "",
"eventTime": "2021-07-01T00:00:00Z",
"contact": {
"email": "[email protected]"
},
"properties": {
"abandonedCheckoutURL": "https://example.com/checkout",
"cartID": "a342-dsfv12",
"currency": "EUR",
"lineItems": [
{
"productCategories": [
{
"id": "123",
"title": "Shoes"
}
],
"productDescription": "The best product with many various features",
"productDiscount": 10,
"productID": "1",
"productImageURL": "https://example.com/product/232423-image.jpg",
"productPrice": 19.99,
"productQuantity": 2,
"productSKU": 200,
"productStrikeThroughPrice": 29.99,
"productTitle": "The best product",
"productURL": "https://example.com/product/232423",
"productVariantID": "123",
"productVariantImageURL": "https://example.com/product/232423-variant-image.jpg"
}
],
"addedItem": {
"productCategories": [
{
"id": "123",
"title": "The best product"
}
],
"productDescription": "The best product with many various features",
"productDiscount": 10,
"productID": "1",
"productImageURL": "https://example.com/product/232423-image.jpg",
"productPrice": 19.99,
"productQuantity": 2,
"productSKU": 200,
"productStrikeThroughPrice": 29.99,
"productTitle": "The best product",
"productURL": "https://example.com/product/232423",
"productVariantID": "123",
"productVariantImageURL": "https://example.com/product/232423-variant-image.jpg"
},
"value": 19.99
}
}
Property explanation & expected types
Value Path | Description | Example | Type |
---|---|---|---|
abandonedCheckoutURL | Store URL for abandoned checkout. When opened by the user it should show the same checkout that user left. | https://example.com/checkout | string |
cartID | Store Cart ID | a342-dsfv12 | string |
currency | Currency code in ISO 4217 format | EUR | string |
lineItems[] | All (max 500) current items in cart. Should contain all cart items. | - | array of objects |
lineItems[].productCategories | Product Categories | - | array of objects |
lineItems[].productCategories.id | Id | 123 | string |
lineItems[].productCategories.title | Title | Shoes | string |
lineItems[].productDescription | Product Description | The best product with many various features | string |
lineItems[].productDiscount | Absolute value of product discount. I.e if current price is 20 and old price is 30, then discount should be 10. | 10 | number |
lineItems[].productID | Product ID | 1 | string |
lineItems[].productImageURL | Direct link to product image | https://example.com/product/232423-image.jpg | string |
lineItems[].productPrice | Current product price | 19.99 | number |
lineItems[].productQuantity | Total added quantity | 2 | number |
lineItems[].productSKU | Current stock units | 200 | string |
lineItems[].productStrikeThroughPrice | Previous product price. This should be filled if product is discounted | 29.99 | number |
lineItems[].productTitle | Full product title | The best product | string |
lineItems[].productURL | URL to product page | https://example.com/product/232423 | string |
lineItems[].productVariantID | Product variant ID | 123 | string |
lineItems[].productVariantImageURL | Direct link to a product variant image | https://example.com/product/232423-variant-image.jpg | string |
addedItem | Added Item | - | object |
addedItem.productCategories | Product Categories | - | array of objects |
addedItem.productCategories.id | Current added product to card product ID | 123 | string |
addedItem.productCategories.title | Full product title | The best product | string |
addedItem.productDescription | Full or partial product description | The best product with many various features | string |
addedItem.productDiscount | Absolute value of product discount. I.e if current price is 20 and old price is 30, then discount should be 10. | 10 | number |
addedItem.productID | Product ID | 1 | string |
addedItem.productImageURL | Direct link to product image | https://example.com/product/232423-image.jpg | string |
addedItem.productPrice | Current product price | 19.99 | number |
addedItem.productQuantity | Total added quantity | 2 | number |
addedItem.productSKU | Current stock units | 200 | string |
addedItem.productStrikeThroughPrice | Previous product price. This should be filled if product is discounted | 29.99 | number |
addedItem.productTitle | Full product title | The best product | string |
addedItem.productURL | URL to product page | https://example.com/product/232423 | string |
addedItem.productVariantID | Product variant ID | 123 | string |
addedItem.productVariantImageURL | Direct link to a product variant image | https://example.com/product/232423-variant-image.jpg | string |
value | Total sum of all cart items | 19.99 | number |