1. Add or Remove products from CartPush data when a product is added to cart, or remove from cart Code Block |
---|
language | js |
---|
title | Add to Cart DataLayer Example |
---|
collapse | true |
---|
| // Measure adding a product to a shopping cart
// and a list of product.
dataLayer.push({
'event': 'addToCart',
'ecommerce': {
'currencyCode': 'EUR', // Currency code used for the PoS
'add': { // 'add' actionFieldObject measures.
'products': [{ // List of product items added to the shopping cart.
'name': 'Museum Pass', // Product Name
'id': '1234-567-987', // Unique SKU of the product item, i.e. product id - item id (if product is non-dated product) - performance id (if product is of event or parking or visit type) - seat category id - tarrif type id - timeslot id (if product is timeslot) - advantage id (if any) (same as enhanced e-commerce dataLayer)
'price': '15.25', // Unit Price
'brand': 'Visit Pass / Exhibition', // Product Family Type / Topic of the product (if set) (same as enhanced e-commerce dataLayer)
'category': 'Cat A / Normal', // Seat category / tarrif type
'variant': 'Cross-sell 1-click / 1234', // Cross selling type / parent product id (if added to cart via cross-selling)
'quantity': 1 // Quantity added to cart for this product item
'url': 'https://mosa.int1-shop.secutix.com/selection/timeslotpass?productId=101047223156' // URL pointing to the corresponding product item selection page which can be used by 3rd-party email retargeting tools
'imgUrl': 'https://mosa.int1-shop.secutix.com/api/1/dl/product/101047223156/logo' // Image URL of the corresponding product item which can be used by 3rd-party email retargeting tools
}]
}
}
}); |
Code Block |
---|
language | js |
---|
title | Remove from Cart DataLayer Example |
---|
collapse | true |
---|
| // Measure the removal of a product from a shopping cart.
dataLayer.push({
'event': 'removeFromCart',
'ecommerce': {
'remove': { // 'remove' actionFieldObject measures.
'products': [{ // removing a product to a shopping cart.
'name': 'Museum Pass', // Product Name
'id': '1234-567-987', // Unique SKU of the product item, i.e. product id - item id (if product is non-dated product) - performance id (if product is of event or parking or visit type) - seat category id - tarrif type id - timeslot id (if product is timeslot) - advantage id (if any) (same as enhanced e-commerce dataLayer)
'price': '15.25', // Unit Price
'brand': 'Visit Pass / Exhibition', // Product Family Type / Topic of the product (if set) (same as enhanced e-commerce dataLayer)
'category': 'Cat A / Normal', // Seat category / tarrif type
'variant': 'Cross-sell 1-click / 1234', // Cross selling type / parent product id (if added to cart via cross-selling)
'quantity': 1 // Quantity added to cart for this product item
}]
}
}
}); |
2. Check outData are sent to datalayer in check out process with 2 steps: Delivery and Order confirmation (after the payment page) Info |
---|
title | Security and data layer |
---|
| Please note that the payment page cannot push any data in the data layer, as this is a secure page and pushing data externally in a secure page is forbidden by the PCI certification. |
When user choose a delivery mode and click on Continue Code Block |
---|
language | js |
---|
title | Delivery step DataLayer Example |
---|
collapse | true |
---|
| <script>
dataLayer.push({
'event': 'ee-checkout',
'ecommerce': {
'checkout': {
'actionField': {
'step': 1, //check out step, (1: Delivery, 2: Summary)
'id': '15284', //shipment Mode ID
'shippingMode': 'E-ticket', // shipment mode name
'shipping': 8 //shipment fee
},
'products': [{ // List of productFieldObjects inside the order.
'name': 'Triblend Android T-Shirt', // Product Name (mandatory).
'id': '12345', // Product Id (mandatory).
'price': '15.25', // Unit Price (mandatory) (same as the basic e-commerce tag).
'brand': 'Visit Pass / Exhibition', // Product Family Type / Topic of the product (if set)
'category': 'Cat A / Normal', // seat category / tarrif type
'variant': 'Cross-sell 1-click / 1234567', // cross selling type / parent product id (if purchased via cross-selling)
'quantity': 1, // same as the basic e-commerce tag
'coupon': 'PartnerCUBE' // advantage name / advantage id
}]
}
}
});
</script> |
When user input a voucher, select a payment method, then click on Continue to Payment Code Block |
---|
language | js |
---|
title | Order summary step DataLayer Example |
---|
collapse | true |
---|
| <script>
dataLayer.push({
'event': 'ee-checkout',
'ecommerce':{
'checkout':{
'actionField':{
'step': 2, //check out step, (1: Delivery, 2: Summary)
'option': 'VISA', //selected payment method name
'id': '1000463', //File ID
'shipmentID': '1111111', // shipment ID, get from Delivery step
'shippingMode': 'E-ticket', // shipment mode name
'shipping': 8, //shipment fee
'payment fee': 4, //payment overhead fee
'revenue': 35, //total amount to pay
'coupon': 'PROMO' //promotional code or voucher code
},
'products': [{ // List of productFieldObjects inside the order.
'name': 'Triblend Android T-Shirt', // Product Name (mandatory).
'id': '12345', // Product Id (mandatory).
'price': '15.25', // Unit Price (mandatory) (same as the basic e-commerce tag).
'brand': 'Visit Pass / Exhibition', // Product Family Type / Topic of the product (if set)
'category': 'Cat A / Normal', // seat category / tarrif type
'variant': 'Cross-sell 1-click / 1234567', // cross selling type / parent product id (if purchased via cross-selling)
'quantity': 1, // same as the basic e-commerce tag
'coupon': 'PartnerCUBE' // advantage name / advantage id
}]
}
}
});
</script> |
|