ecommerceAddToCart
The ecommerceAddToCart() method tracks when a product is added to the cart.
Syntax
ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
eCommerce.ecommerceAddToCart(products[, options])
Parameters
Product Object
Attribute | Type | Description | Required |
---|---|---|---|
sku | string | Product stock-keeping unit. | Yes |
name | string | Product name (default: “”). | No |
category | string | Array<string> | Product category or an array of up to 5 categories. Default: “”. | No |
price | number | string | Product price must be a float number or a string containing float number representation. Default: 0. | No |
quantity | number | string | Product quantity must be an integer number or a string containing integer representation. Default: 1. | No |
brand | string | Product brand. Default: “”. | No |
variant | string | Product variant. Default: “”. | No |
customDimensions | object | Product custom dimensions. Default: {}. | No |
Options Object
Option | Type | Description | Required |
---|---|---|---|
currencyCode | string | Currency of the 'conversionValue' in ISO 4217 format. If not provided, the currency set in app settings will be used instead. | No |
Examples
_paq.push([
"ecommerceAddToCart",
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" },
]);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
eCommerce.ecommerceAddToCart(
[
{
sku: "craft-311",
name: "Unicorn Iron on Patch",
category: "Crafts & Sewing",
price: "49.90",
quantity: 3,
brand: "DMZ",
variant: "blue",
customDimensions: {
1: "coupon-2020",
2: "20%",
},
},
],
{ currencyCode: "EUR" }
);
Related methods
Updated 6 days ago