Sync Cart

Updates the current cart state.

❗️

This event is madatory for:

Parameters

  • name: Human-readable name, not used to identify an event type
  • properties: A container for the event properties as specified in the following table:
PropertyDescriptionType
dyTypeMust be "sync-cart-v1".String
valueThe total monetary value of the event (value of the total cart contents, not just the item that triggered the event); in the actual payment currency.Float (dollars.cents).

Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0.
currency

Optional, but required for multi-currency sites
The currency used for the value (if other than the default currency)String
List of supported currencies
cartThe cart's absolute current state, including the last item added. Products are ordered from the first added to the cart to the most recent.Object

See the cart property table that follows for details.

Cart object properties:

PropertyDescriptionType
productIdSKU exactly as it appears in the product feedString
quantityNumber of itemsNumber
itemPriceThe price of the item addedFloat in the format: dollars.cents

Example: Implementation via script

DY.API("event", {
  name: "Sync cart",
  properties: {
    dyType: "sync-cart-v1",
    value: 125.50,
    currency: "any supported currency code", // Optional non-default currency used
    cart: [ //Mandatory, the order of products should be from oldest to newest
      {
        productId: "sku-4324-bg",
        quantity: 2,
        itemPrice: 12.34,
      },
      {
        productId: "item-34454",
        quantity: 1,
        itemPrice: 34.45
      }
    ]
  }
});

Example: Implementation via Experience API (server-side)

"events":[
  {
  name: "Sync cart",
  properties: {
    dyType: "sync-cart-v1",
    value: 125.50,
    currency: "any supported currency code", // Optional non-default currency used
    cart: [ //Mandatory, the order of products should be from oldest to newest
      {
        productId: "sku-4324-bg",
        quantity: 2,
        itemPrice: 12.34,
      },
      {
        productId: "item-34454",
        quantity: 1,
        itemPrice: 34.45
      }
    ]
  }
} ]

👍

Go to the API reference for the Events endpoint to learn more.


Further Reading

See the [API reference for the Events endpoint] (/reference/reporting-events-api) for more information.