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.
Value | Type | Required | Description |
---|---|---|---|
productId | String | Yes | The product ID or SKU (e.g. 632910392). |
variant | String | Yes | The variant of the product (e.g. 808950810). |
quantity | Number | Yes | The number of units added to the cart (e.g. 1). |
productImageUrl | String | No | The encoded URL for an image of the product (starts with http or https). |
productUrl | String | No | The encoded URL for the product page (starts with http or https). |
brand | String | No | The brand to which the product belongs (e.g. Acme). |
category | String | No | The 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). |
color | String | No | The color of the product (e.g. Black). |
productName | String | No | The name of the product (e.g. Nyan Cat T-Shirt). |
size | String | No | The size of the product (e.g. Medium). |
style | String | No | The style of the product (e.g. Slim Cut). |
price | Number | No | The price of a product (e.g. 24.95). |
properties | Object | No | An object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }). |
cartItems | Array | No | An 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', {
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',
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. Top level custom properties for the event can be provided in the properties
object.
The following table describes the composition of an element in the cartItems
array, which contains the full cart contents:
Value | Type | Required | Description |
---|---|---|---|
cartItems | Array | Yes | An array with the full contents of the cart (e.g. [{item 1 parameters},{item 2 parameters},...]). |
productId | String | Yes | The product ID or SKU (e.g. 632910392). |
variant | String | Yes | The variant of the product (e.g. 808950810). |
quantity | Number | Yes | The quantity of the product added to the cart (e.g. 1). |
productImageUrl | String | No | The encoded URL for an image of the product (starts with http or https). |
productUrl | String | No | The encoded URL for the product page (starts with http or https). |
brand | String | No | The brand to which the product belongs (e.g. Acme). |
category | String | No | The 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). |
color | String | No | The color of the product (e.g. Black). |
productName | String | No | The name of the product (e.g. Nyan Cat T-Shirt). |
size | String | No | The size of the product (e.g. Medium). |
style | String | No | The style of the product (e.g. Slim Cut). |
price | Number | No | The price of a product (e.g. 24.95). |
properties | Object | No | An 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.
Value | Type | Required | Description |
---|---|---|---|
productId | String | Yes | The product ID or SKU (e.g. 632910392). |
variant | String | Yes | The variant of the product (e.g. 808950810). |
quantity | Number | Yes | The new quantity of the product in the cart (e.g. 2). |
productImageUrl | String | No | The encoded URL for an image of the product (starts with http or https). |
productUrl | String | No | The encoded URL for the product page (starts with http or https). |
brand | String | No | The brand to which the product belongs (e.g. Acme). |
category | String | No | The 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). |
color | String | No | The color of the product (e.g. Black). |
productName | String | No | The name of the product (e.g. Nyan Cat T-Shirt). |
size | String | No | The size of the product (e.g. Medium). |
style | String | No | The style of the product (e.g. Slim Cut). |
price | Number | No | The price of a product (e.g. 24.95). |
previousQuantity | Number | No | The previous quantity of the product in the cart (e.g. 1). |
properties | Object | No | An object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }). |
cartItems | Array | No | An 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.
Value | Type | Required | Description |
---|---|---|---|
productId | String | Yes | The product ID or SKU (e.g. 632910392). |
variant | String | Yes | The variant of the product (e.g. 808950810). |
quantity | Number | Yes | The quantity of items that are removed for that product in the cart (e.g. 2). |
productImageUrl | String | No | The encoded URL for an image of the product (starts with http or https). |
productUrl | String | No | The encoded URL for the product page (starts with http or https). |
brand | String | No | The brand to which the product belongs (e.g. Acme). |
category | String | No | The 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). |
color | String | No | The color of the product (e.g. Black). |
productName | String | No | The name of the product (e.g. Nyan Cat T-Shirt). |
size | String | No | The size of the product (e.g. Medium). |
style | String | No | The style of the product (e.g. Slim Cut). |
price | Number | No | The price of a product (e.g. 24.95). |
properties | Object | No | An object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }). |
cartItems | Array | No | An 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
.
Value | Type | Required | Description |
---|---|---|---|
transactionId | String | Yes | The transaction ID (e.g. 122710332). |
revenue | Number | Yes | Specifies the revenue associated with the transaction (e.g. 49.90). It does not include shipping or tax costs. |
cartItems | Array | Yes | An array containing data about the products in the transaction (See table below). |
shipping | Number | No | Specifies the total shipping cost of the transaction. (e.g. 5.00). |
tax | Number | No | Specifies the total tax of the transaction. (e.g. 2.29). |
promotion | String | No | The promotion ID (e.g. PROMO_1234). |
properties | Object | No | An object of extra arguments (e.g. { campaignId: '12345' }). |
The following table describes the composition of an element in the cartItems
array:
Value | Type | Required | Description |
---|---|---|---|
productId | String | Yes | The product ID or SKU (e.g. 632910392). |
variant | String | Yes | The variant of the product (e.g. 808950810). |
quantity | Number | Yes | The quantity of the product added to the cart (e.g. 1). |
productImageUrl | String | No | The encoded URL for an image of the product (starts with http or https). |
productUrl | String | No | The encoded URL for the product page (starts with http or https). |
brand | String | No | The brand to which the product belongs (e.g. Acme). |
category | String | No | The 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). |
color | String | No | The color of the product (e.g. Black). |
productName | String | No | The name of the product (e.g. Nyan Cat T-Shirt). |
size | String | No | The size of the product (e.g. Medium). |
style | String | No | The style of the product (e.g. Slim Cut). |
price | Number | No | The price of a product (e.g. 24.95). |
properties | Object | No | An object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }). |