Skip to main content

Add to cart event

Abstract

Explains composition and usage of the Sitecore Discover add to cart event object.

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

type

String

Required.

Type of the event.

a2c

name

String

Required.

Name of the event, usually it is the name of the page where the event happened.

  • home

  • pdp

  • category

  • cart

  • qview

value.products

Array

Required.

Array containing a single product object.

n/a

value.products[].sku

String

Required.

SKU of the product that the user added to the cart.

n/a

value.products[].price

Float

Required.

Price of the product that is added to the cart.

n/a

value.products[].quantity

Integer

Required.

The number of units of products that a user added to the cart.

n/a

value.products[].fitment

Array

Required if site supports fitments.

An array of fitment objects. Refer to products, fitments for more details.

n/a

value.context.page

Object

Required if site is set up with locale configuration.

Add page-specific information (including locale information) under the page object.

n/a

value.locale (deprecated)

Object

Optional.

A locale object. This attribute is deprecated. We suggest you use the page object for locale data.

n/a

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"
          ]
        }
      }
    ]
  }