Add to Cart

This is an example of an Add To Cart event:

sd.track('add_to_cart', {
  productId: '632910392',
  variant: '808950810',
  quantity: 1,
  productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
  productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
  brand: 'Acme',
  category: 'Apparel/Men/T-Shirts',
  color: 'Black',
  productName: 'Nyan Cat T-Shirt',
  price: 24.95,
  properties: {
    desc: 'Slim cut t-shirt with a cat on it'
  },
  cartItems: [{
    productId: '632910392',
    variant: '808950810',
    quantity: 1,
    productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
    productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
    brand: 'Acme',
    category: 'Apparel/Men/T-Shirts',
    color: 'Black',
    productName: 'Nyan Cat T-Shirt',
    price: 24.95,
    properties: {
      desc: 'Slim cut t-shirt with a cat on it'
    }  
  }]
});

Products added to cart are captured using the track command with the add_to_cart event type. Details about the product are added in an eventObject.

The call to add_to_cart supports an optional cartItems array with all the items in the cart and their corresponding parameters (productId, variant etc.). cartItems should include the product that was just added.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe number of units added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 parameters},{item 2 parameters},...]).

Cart

This is an example of a Cart event:

sd.track('cart', {
  cartItems: [{
    productId: '632910392',
    variant: '808950810',
    quantity: 1,
    productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
    productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
    brand: 'Acme',
    category: 'Apparel/Men/T-Shirts',
    color: 'Black',
    productName: 'Nyan Cat T-Shirt',
    price: 24.95,
    properties: {
      desc: 'Slim cut t-shirt with a cat on it'
    }  
  }]
});

The complete contents of a cart can be sent using the track command with the cart event type. Details about the product are added in a cartItems array.

The following table describes the composition of an element in the cartItems array, which contains the full cart contents:

ValueTypeRequiredDescription
cartItemsArrayYesAn array with the full contents of the cart (e.g. [{item 1 parameters},{item 2 parameters},...]).
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of the product added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Update Cart

This is an example of an Update Cart event:

sd.track('update_cart', {
  productId: '632910392',
  variant: '808950810',
  quantity: 2,
  previousQuantity: 1,
  productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
  productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
  brand: 'Acme',
  category: 'Apparel/Men/T-Shirts',
  color: 'Black',
  productName: 'Nyan Cat T-Shirt',
  price: 24.95,
  properties: {
    desc: 'Slim cut t-shirt with cat on it'
  },
  cartItems: [{
    productId: '632910392',
    variant: '808950810',
    quantity: 2,
    productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
    productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
    brand: 'Acme',
    category: 'Apparel/Men/T-Shirts',
    color: 'Black',
    productName: 'Nyan Cat T-Shirt',
    price: 24.95,
    properties: {
      desc: 'Slim cut t-shirt with a cat on it'
    }
  }]
});

Update cart actions are measured using the track command with the update_cart event type. Details about the product are added in an eventObject. Like the add_to_cart event, update_cart supports an optional cartItems array with the full cart contents including the most recent update.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe new quantity of the product in the cart (e.g. 2).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
previousQuantityNumberNoThe previous quantity of the product in the cart (e.g. 1).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 properties},{item 2 properties},...]).

Remove From Cart

This is an example of a Remove From Cart event:

sd.track('remove_from_cart', {
  productId: '632910392',
  variant: '808950810',
  quantity: 2,
  brand: 'Acme',
  category: 'Apparel/Men/T-Shirts',
  color: 'Black',
  productName: 'Nyan Cat T-Shirt',
  price: 24.95,
  properties: {
    desc: 'Slim cut t-shirt with cat on it'
  }
});

Remove from cart actions are measured using the track command with the remove_from_cart event type. Details about the product are added in an eventObject. Like the add_to_cart event, remove_from_cart supports an optional cartItems array to send the full cart contents after the removed item.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of items that are removed for that product in the cart (e.g. 2).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 properties},{item 2 properties},...]).

Complete Transaction

This is an example of a Complete Transaction event:

sd.track('complete_transaction', {
  transactionId: '122710332',
  revenue: 49.90,
  shipping: 5.00,
  tax: 2.29,
  promotion: 'PROMO_1234',
  properties: {
    campaignId: '12345'
  },
  cartItems: [
    {
      productId: '632910392',
      variant: '808950810',
      quantity: 1,
      productImageUrl:'https://cdn.simondata.com/files/808950810.jpg',
      productUrl:'https://www.simondata.com/apparel/t-shirts/808950810',
      brand: 'Acme',
      category: 'Apparel/Men/T-Shirts',
      color: 'Black',
      productName: 'Nyan Cat T-Shirt',
      size: 'Medium',
      style: 'Slim Cut',
      price: 24.95,
      properties: {
        desc: 'Slim cut t-shirt with cat on it'
      }
    },
    {
      productId: '331910392',
      variant: '408950811',
      quantity: 1,
      productImageUrl:'https://cdn.simondata.com/files/408950811.jpg',
      productUrl:'https://www.simondata.com/apparel/t-shirts/408950811',
      brand: 'Acme',
      category: 'Apparel/Men/T-Shirts',
      color: 'White',
      productName: 'Inner Space T-Shirt',
      size: 'Medium',
      style: 'Slim Cut',
      price: 24.95,
      properties: {
        desc: 'Slim cut t-shirt with planets on it'
      }
    }
  ]
});

Successful transactions are measured using the track command with the complete_transaction event type. Details about the product are added in an eventObject.

ValueTypeRequiredDescription
transactionIdStringYesThe transaction ID (e.g. 122710332).
revenueNumberYesSpecifies the revenue associated with the transaction (e.g. 49.90). It does not include shipping or tax costs.
cartItemsArrayYesAn array containing data about the products in the transaction (See table below).
shippingNumberNoSpecifies the total shipping cost of the transaction. (e.g. 5.00).
taxNumberNoSpecifies the total tax of the transaction. (e.g. 2.29).
promotionStringNoThe promotion ID (e.g. PROMO_1234).
propertiesObjectNoAn object of extra arguments (e.g. { campaignId: '12345' }).

The following table describes the composition of an element in the cartItems array:

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of the product added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).