Developers » AS2 tagging » JavaScript » Ecommerce » Sales Insights » Cart Events
Cart Events
Foreword
This tagging documentation only applies to Tracker from version 5.18.0.
Before beginning implementation of Sales Insights, please make sure you have read the events’ getting started.
If you can’t see the “Sales Insights” menu entry in Explorer, please get in touch with us so we get this activated for you.
Cart Events
The plugin provides different useful functions for measuring:
- cart displays
- cart updates
- shipping and payment steps
- cart awaiting payment
Cart display
The Tracker has a declaration method:
- tag.ecommerce.displayCart.cart.set()
Measuring a cart display is done via declaring a cart object.
The cart is displayed as an object that can have the following properties:
- “id” – String: Cart ID (this parameter is mandatory).
- “currency” – String: Currency.
- “turnovertaxincluded” – Float: Total cart amount, tax incl.
- “turnovertaxfree” – Float: Total cart amount, tax excl.
- “quantity” – Number: Number of products in cart.
- “nbdistinctproduct” – Number: Number of distinct products in cart.
Example
var tag = new ATInternet.Tracker.Tag(); tag.ecommerce.displayCart.cart.set({ "id": "34", "currency": "EUR", "turnovertaxincluded": 549, "turnovertaxfree": 456.2, "quantity": 1, "nbdistinctproduct": 1 }); tag.dispatch();
Cart update
The Tracker has two declaration methods:
- tag.ecommerce.updateCart.cart.set()
Measuring a cart update is done via declaring a cart object.
The cart is declared as an object that can have the following properties:
- “id” – String: Cart ID (this parameter is mandatory).
- “currency” – String: Currency.
- “turnovertaxincluded” – Float: Total cart amount, tax incl.
- “turnovertaxfree” – Float: Total cart amount, tax excl.
- “quantity” – Number: Number of products in cart.
- “nbdistinctproduct” – Number: Number of distinct products in cart.
Example
var tag = new ATInternet.Tracker.Tag(); tag.ecommerce.updateCart.cart.set({ "id": "34", "currency": "EUR", "turnovertaxincluded": 1098, "turnovertaxfree": 912.4, "quantity": 2, "nbdistinctproduct": 1 }); tag.dispatch();
Display of shipping step
The Tracker has the following declaration methods:
- tag.ecommerce.deliveryCheckout.cart.set()
- tag.ecommerce.deliveryCheckout.shipping.set()
Measuring of the shipping step is done via declaring a cart object and a shipping object.
The cart is declared as an object that can have the following properties:
- “id” – String: Cart ID (this parameter is mandatory).
- “currency” – String: Currency.
- “turnovertaxincluded” – Float: Total cart amount, tax incl.
- “turnovertaxfree” – Float: Total cart amount, tax excl.
- “quantity” – Number: Number of products in cart.
- “nbdistinctproduct” – Number: Number of distinct products in cart.
Shipping information is declared as an object that can have the following properties (to be filled in if known at this step):
- “delivery” – String: Name of delivery provider
- “costtaxincluded” – Float: Shipping fees, tax incl.
- “costtaxfree” – Float: Shipping fees, tax excl.
Delivery data only needs to be entered once, either in the delivery step or in the payment step.
Example
var tag = new ATInternet.Tracker.Tag(); tag.ecommerce.deliveryCheckout.cart.set({ "id": "34", "currency": "EUR", "turnovertaxincluded": 557.4, "turnovertaxfree": 463.2, "quantity": 1, "nbdistinctproduct": 1 }); tag.ecommerce.deliveryCheckout.shipping.set({ "delivery": "My carrier", "costtaxincluded": 8.4, "costtaxfree": 7 }); tag.dispatch();
Display of payment step
The Tracker has the following declaration methods:
- tag.ecommerce.paymentCheckout.cart.set()
- tag.ecommerce.paymentCheckout.shipping.set()
Measuring the payment step is done via declaring a cart object and a shipping object.
The cart is declared as an object that can have the following properties:
- “id” – String: Cart ID (this parameter is mandatory).
- “currency” – String: Currency.
- “turnovertaxincluded” – Float: Total cart amount, tax incl.
- “turnovertaxfree” – Float: Total cart amount, tax excl.
- “quantity” – Number: Number of products in cart.
- “nbdistinctproduct” – Number: Number of distinct products in cart.
Shipping information is declared as an object that can have the following properties:
- “delivery” – String: Name of delivery provider.
- “costtaxincluded” – Float: Shipping fees, tax incl.
- “costtaxfree” – Float: Shipping fees, tax excl.
Delivery data only needs to be entered once, either in the delivery step or in the payment step.
Example
var tag = new ATInternet.Tracker.Tag(); tag.ecommerce.paymentCheckout.cart.set({ "id": "34", "currency": "EUR", "turnovertaxincluded": 557.4, //Shipping fees included "turnovertaxfree": 463.2, //Shipping fees included "quantity": 1, "nbdistinctproduct": 1 }); tag.ecommerce.paymentCheckout.shipping.set({ "delivery": "My carrier", "costtaxincluded": 8.4, "costtaxfree": 7 }); tag.dispatch();
Cart awaiting payment
A cart awaiting payment has to be validated with a transaction confirmation on server-side.
A 24 hours limitation is set up between cart.awaiting_payment and the associated transaction.confirmation.
The Tracker has the following declaration methods available since version 5.18.0:
- tag.ecommerce.cartAwaitingPayment.cart.set()
- tag.ecommerce.cartAwaitingPayment.products.set()
- tag.ecommerce.cartAwaitingPayment.shipping.set()
- tag.ecommerce.cartAwaitingPayment.payment.set()
- tag.ecommerce.cartAwaitingPayment.transaction.set()
Measuring a cart awaiting payment is done via declaring a cart object, a delivery object, a payment object and a transaction object.
The cart is displayed as an object that can have the following properties:
- “id” – String: Cart ID (this parameter is mandatory).
- “currency” – String: Currency (ISO 4217 standard – ex: EUR).
- “turnovertaxincluded” – Float: Total cart amount, tax incl.
- “turnovertaxfree” – Float: Total cart amount, tax excl.
- “creation_utc” – Date: Date of shopping cart creation (UTC timestamp in seconds).
- “quantity” – Number: Number of products in cart.
- “nbdistinctproduct” – Number : Number of distinct products in cart.
A product is declared as an object that can have the following properties:
- “id” – String: Product ID (this parameter is mandatory).
- “variant” – String: Product variant (size, color, etc.).
- “$” – String: Product name.
- “brand” – String: Product brand.
- “discount” – Boolean: Discounted product (0 for no; 1 for yes).
- “pricetaxincluded” – Float: Product price, tax incl.
- “pricetaxfree” – Float: Product price, tax excl.
- “currency” – String: Currency.
- “stock” – Boolean: Product in stock (0 for no; 1 for yes).
- “quantity” – Number: Number of products to remove from cart.
- “category1” – String: Product 's level 1 category (up to 6 tree structure levels possible; from “category1” to “category6”).
Shipping information is declared as an object that can have the following properties:
- “delivery” – String : Nom du transporteur.
- “costtaxincluded” – Float : Montant des frais de livraison TTC.
- “costtaxfree” – Float : Montant des frais de livraison HT.
The payment method is declared as an object with the following property:
- “mode” – String: Payment method.
The transaction is declared as an object that can have the following properties:
- “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
- “firstpurchase” – Boolean: First customer purchase.
Example
var tag = new ATInternet.Tracker.Tag(); tag.ecommerce.cartAwaitingPayment.cart.set({ "id": "34", "currency": "EUR", "turnovertaxincluded": 557.4, //Shipping fees included "turnovertaxfree": 463.2, //Shipping fees included "creation_utc": 1514973161, //UTC timestamp in seconds "quantity": 1, "nbdistinctproduct": 1 }); tag.ecommerce.cartAwaitingPayment.products.set([{ "id": "1", "variant": "1", "$": "laptop_A56", "brand": "ACER", "discount": true, "pricetaxincluded": 549, "pricetaxfree": 456.2, "currency": "EUR", "stock": true, "quantity": 1, "category1": "Computers_and_Networking", "category2": "Computers", "category3": "Laptops" }]); tag.ecommerce.cartAwaitingPayment.shipping.set({ "delivery": "My carrier", "costtaxincluded": 8.4, "costtaxfree": 7 }); tag.ecommerce.cartAwaitingPayment.payment.set({"mode": "Credit card"}); tag.ecommerce.cartAwaitingPayment.transaction.set({ "promocode": ["DQQYRZSJ", "UN1ENE27"], "firstpurchase": true }); tag.dispatch();
Appendices
Tagging methods
- tag.ecommerce.displayCart.cart.set
- tag.ecommerce.updateCart.cart.set
- tag.ecommerce.deliveryCheckout.cart.set
- tag.ecommerce.deliveryCheckout.shipping.set
- tag.ecommerce.paymentCheckout.cart.set
- tag.ecommerce.paymentCheckout.shipping.set
- tag.ecommerce.cartAwaitingPayment.cart.set (since version 5.18.0)
- tag.ecommerce.cartAwaitingPayment.shipping.set (since version 5.18.0)
- tag.ecommerce.cartAwaitingPayment.payment.set (since version 5.18.0)
- tag.ecommerce.cartAwaitingPayment.transaction.set (since version 5.18.0)