The ecommerce object is a way to provide performance metrics for events that enrich the data you collect.
The ecommerce object shares properties across events in order to provide consistent metrics.
Page View events are automatically collected by the Tapscale package. In an ecommerce focused implementation, this default behavior might need to be overridden in order to collect product data. Alternatively, we recommend the use of a productView event instead.
Sending a productView event is as simple as calling the Tap.track() method with the productView event name.
tap.trk({
eventName: 'productView',
ecommerce: {
items:[
{
itemId: '123456',
itemName: 'Product Name',
itemPrice: 100,
itemQuantity: 1,
itemCategory: 'Product Category',
itemVariant: '123456'
}
]
}
})Add to cart events are similar to productView events, but they are used to track when a user adds a product to their cart.
tap.trk({
eventName: 'addToCart',
ecommerce: {
items:[
{
itemId: '123456',
itemName: 'Product Name',
itemPrice: 100,
itemQuantity: 1,
itemCategory: 'Product Category',
itemVariant: 'Product Variant'
}
]
}
})Conversion events are used to track when a user completes a purchase. This can also be used to track other conversion events, such as a lead form submission or whatever relevant business goal you are trying to track.
tap.trk({
eventName: 'conversion',
ecommerce: {
items:[
{
itemId: '123456',
itemName: 'Product Name',
itemPrice: 100,
itemQuantity: 1,
itemCategory: 'Product Category',
itemVariant: 'Product Variant'
}
]
}
})The ecommerce object can also be attached to any custom event. Just pass a consistent eventName and the new event will be created.
tap.trk({
eventName: 'subscribe',
ecommerce: {
items:[
{
itemId: '123456',
itemName: 'Monthly Subscription',
itemPrice: 10,
itemQuantity: 1,
itemCategory: 'Subscription',
itemVariant: 'Monthly'
}
]
}
})