Add to cart event
The add to cart
event (a2c:<page title>
) must be sent when a user adds a product to the shopping cart. This event is required to compute cart abandonment metrics. If you do not send this event, the Sitecore Discover category and product analytics cannot report cart abandonment metrics.
The following table lists the attributes of the add to cart
event:
Name |
Type |
Description |
Value |
---|---|---|---|
|
String |
Required. Type of the event. |
|
|
String |
Required. Name of the event, usually it is the name of the page where the event happened. |
|
|
Array |
Required. Array containing a single product object. |
n/a |
|
String |
Required. SKU of the product that the user added to the cart. |
n/a |
|
Float |
Required. Price of the product that is added to the cart. |
n/a |
|
Integer |
Required. The number of units of products that a user added to the cart. |
n/a |
|
Array |
Required if site supports fitments. An array of fitment objects. Refer to products, fitments for more details. |
n/a |
|
Object |
Required if site is set up with locale configuration. Add page-specific information (including locale information) under the page object. |
n/a |
|
Object |
Optional. A locale object. This attribute is deprecated. We suggest you use the page object for locale data. |
n/a |
Sample event specification
The following is an example of an add to cart
event object. This example is in the new format, which means it contains a context
object.
{
"type": "a2c",
"name": "home",
"value": {
"context": {
"page": {
"locale_country": "<country code, 2 letters, lowercase, e.g. fr>",
"locale_language": "<language code, 2 letters, lowercase, e.g. en>",
"locale_currency": "<currency code, 3 letters, lowercase, e.g. eur>"
}
},
"products": [
{
"sku": "191258",
"quantity": 1,
"price": 11.99,
"fitment": {
"ids": [
"3333"
]
}
}
]
}