Cart Events (Sales Insights)

 

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

      It is possible to enable in addition an automatic tagging for SalesTracker cart content by overloading a setup variable “autoSalesTracker” available in sub-object “Ecommerce“:

      var config = {
          Ecommerce: {
              autoSalesTracker: true
          }
      };
      var tag = new ATInternet.Tracker.Tag(config);
    • cart updates
    • shipping and payment steps
    • cart awaiting payment

It is possible to enable in addition an automatic tagging for SalesTracker orders by overloading a setup variable “autoSalesTracker” available in sub-object “Ecommerce“:

var config = {
    Ecommerce: {
        autoSalesTracker: true
    }
};
var tag = new ATInternet.Tracker.Tag(config);

See the full list of setup variables that can be overloaded at the bottom of the page.

 

Cart display

The Tracker has a declaration method:

  • tag.ecommerce.displayCart.cart.set()

Measuring a cart display is done via declaring a cart object and a product table.
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.

The product table can include one or several products.

A product is declared as an object that can have the following properties:

  • “id” – String: Product ID (this parameter is mandatory).
  • “$” – String: Product name.
  • “pricetaxincluded” – Float: Product price, tax incl.
  • “pricetaxfree” – Float: Product price, tax excl.
  • “quantity” – Number: Number of products in cart.
  • “category1” – String: Product’s level 1 category (up to 6 tree structure levels possible; from “category1” to “category6”).

Product declaration is optional for Ecommerce analysis. The products, if declared, will only enrich the analysis of sales/orders for SalesTracker. The parameters to be declared are therefore limited to those required for SalesTracker tagging.

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.ecommerce.displayCart.products.set([{
    "id": "1",
    "$": "laptop_ACER_A56",
    "pricetaxincluded": 549,
    "pricetaxfree": 456.2,
    "quantity": 1,
    "category1": "Home",
    "category2": "Computers_and_Networking",
    "category3": "Computers",
    "category4": "Laptops",
    "category5": "Acer",
    "category6": "Chromebook"
}]);
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.

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.
  • “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” – String: First customer purchase (0 for no; 1 for yes).

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": 1,
    "pricetaxincluded": 549,
    "pricetaxfree": 456.2,
    "currency": "EUR",
    "stock": 1,
    "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": 1
});
tag.dispatch();
 

Appendices

 

Tagging methods

  • tag.ecommerce.displayCart.cart.set
  • tag.ecommerce.displayCart.products.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)
 

Setup variables

Name Default value Description Version
Ecommerce.collectDomain “” Sales Insights collect domain  >= 5.13.0
Ecommerce.autoSalesTracker false Enable automatic SalesTracker order content measurement on a transaction confirmation event  >= 5.13.0
 

Was this post helpful?

Last update: 13/08/2019