E-commerce Events function very similarly to the custom events feature. It relies on the global va function available in the website of the user that sends the events through the worker to the API.
ecom - to specify this is an e-com event
The type of the events from the list below
The payload of the event
The events follow a very similar structure to Google Analytics in order to ease migration.
va('ecom','add_payment_info',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"method":"Credit Card"
})
va('ecom','add_shipping_info',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"shippingTier":"DHL"
})
va('ecom','add_to_cart',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','add_to_wishlist',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','begin_checkout',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"coupon": "DISCOUNT CODE",
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','generate_lead',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00
})
va('ecom','login',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"method": "Basic auth"
})
va('ecom','purchase',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"transaction_id": "PayPal12312321312",
"currency": "RON",
"value": 6502.30,
"coupon": "DISCOUNT_CODE",
"shipping":12.50,
"tax": 850.21,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','refund',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"transaction_id": "PayPal12312321312",
"currency": "RON",
"value": 6502.30,
"coupon": "DISCOUNT_CODE",
"shipping":12.50,
"tax": 850.21,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','remove_from_cart',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','share',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"method": "Twitter",
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','sign_up',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"method": "Google"
})
va('ecom','view_cart',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','view_item',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})
va('ecom','view_item_list',{
"customer": {
"id": "internalID",
"name": "John Smith",
"email": "john@smith.com",
"phoneNumber": "+4012312312312"
},
"term": "Item List Name",
"currency":"RON",
"value":0.00,
"items":[
{
"id": "SKU_123",
"item_name": "iPhone 15",
"affiliation": "Magazin online #1",
"coupon": "50%OFF",
"discount": 10,
"index": 0,
"item_brand": "Apple",
"item_category": "Category 1",
"item_category2": "Category 2",
"item_category3": "Category 3",
"item_category4": "Category 4",
"item_category5": "Category 5",
"item_list_id": "LIST-123",
"item_list_name": "John's wishlist",
"item_variant": "Sky Blue",
"location_id": "Online shop #2",
"price": 6512.30,
"quantity": 1,
"image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
}
]
})