Cart / Order content

 

Foreword

Before starting implementation of the SalesTracker plugin, please make sure you have initialised the AT Internet JavaScript Tracker and selected the plugin from within the Tag Composer interface.

 

Tagging methods

The  SalesTracker JavaScript makes it possible to measure shopping cart consultations and orders contents.

The Tracker has two methods “cart.set()” et “cart.add()”.

Properties marked with a * need the SalesTracker option in order to be processed.

The method “order.set()” takes as a parameter an object whose properties are as follows:

  • * cartId: Cart number.
  • * isBasketPage: Basket-type page variable (true/false).

The method “cart.add()” takes a “product” object as a parameter whose properties are as follows:

  • * category1 to category6: Product categories (up to 6 levels) with format ‘ID[category_label]’.
  • * productId: Product ID with format ‘ID[product_label]’.
  • * quantity: Product quantity.
  • * unitPriceTaxIncluded: Price per unit, tax incl.
  • * unitPriceTaxFree: Price per unit, tax excl.
  • * discountTaxIncluded: Discount, tax incl.
  • * discountTaxFree: Discount, tax excl.
  • * promotionalCode: Promo code.

See Appendix for more details about category and product ID format.

You should associate your SalesTracker tag with a Page tag, “tag.page.set(), so that it is treated. See Measuring pages for more information.

 

Tagging a basket viewing

The tagging of basket viewing is made possible by the use of the method “cart.set()” with property “isBasketPage” set to true and by the use of “cart.add()” to declare basket products.

Here is an example of basket viewing code:

var tag = new ATInternet.Tracker.Tag();
// set page
tag.page.set({
    name:'pageName'
});
// set cart
tag.cart.set({cartId: 8235, isBasketPage: true});
tag.cart.add({
    product: {
        category1: '1[Computers_and_Networking]',
        category2: '25[Computers]',
        category3: '56[Laptops]',
        productId: '564[laptop_ACER_A56]',
        quantity: 1,
        unitPriceTaxIncluded: 549,
        unitPriceTaxFree: 456.2,
        discountTaxIncluded: 10,
        discountTaxFree: 8.04,
        promotionalCode: 'Offer_New_Customer'
    }
});
tag.cart.add({
    product: {
        category1: '1[Computers_and_Networking]',
        category2: '25[Computers]',
        category3: '56[Laptops]',
        productId: '42[laptop_ASUS_N550JK]',
        quantity: 1,
        unitPriceTaxIncluded: 999,
        unitPriceTaxFree: 840,
        discountTaxIncluded: 10,
        discountTaxFree: 8.04,
        promotionalCode: 'Offre_New_Customer'
    }
});
tag.dispatch();

Explanations

The basket viewing is made up of two products:

1 ACER A56 laptop for a total of 549€ tax included (456.22€ without tax), a discount of 10€ (8.04€ without tax) is applied to this product.

1ASUS N550JK laptop for a total of 999€ tax included (840 without tax), a discount of 10€ (8.04€ without tax) is applied to this product.

All items in the cart with their categories are mandatory. The basket ID must be entered “cartId”; it must be identical to the one present in the order content tag; in the opposite case, the basket will be considered as abandoned.

 

Tagging an order content

The tags placed on your site must pass all information linked to the order/reservation to our servers, to know the products, their quantity, and the total [Qty x price per unit]- discount).

These tags are taken into account only on primary goal pages.

Here is an example of code to retrieve order content information:

var tag = new ATInternet.Tracker.Tag();
// set page
tag.page.set({
    name:'pageName'
});
// set order
tag.order.set({...});
// set order content
tag.cart.set({cartId: 8235});
tag.cart.add({
    product: {
        category1: '1[Computers_and_Networking]',
        category2: '25[Computers]',
        category3: '56[Laptops]',
        productId: '564[laptop_ACER_A56]',
        quantity: 1,
        unitPriceTaxIncluded: 549,
        unitPriceTaxFree: 456.2,
        discountTaxIncluded: 10,
        discountTaxFree: 8.04,
        promotionalCode: 'Offer_New_Customer'
    }
});
tag.dispatch();

Explanations

The order is made up of one product:

1 ACER A56 laptop for a total of 549€ tax included (456.22€ without tax), a discount of 10€ (8.04€ without tax) is applied to this product.

This order allows you to add the following categories:

  • Computers and Networking
  • Computers
  • Laptops

To determine the sales turnover by category, it is necessary to enter the category in the order content.

 

Product discounts

Discounts can also apply to the product in addition to order (see section Order for more information about global discounts).

Consequently:

  • If both discounts are entered (order + product), the order discount must be equal or superior to the product discount. In this case, the product discount is included in the order discount.
  • If the order discount is not entered, a sum of product discounts is applied at the order level.

The discount total to be entered must be the sum across all the entire quantity of purchased products. Taking the example of a product whose price per unit is “100 €” and whose quantity is “2”, we can distinguish several scenarios:

– The product discount is applied to all quantities of this product in the case of a discount like “Buy 2 products, get 15€ off your order”.

var tag = new ATInternet.Tracker.Tag();
// set page
tag.page.set({
    name:'pageName'
});
// set order 
tag.order.set({...});
// set order content
tag.cart.set({cartId: 8235});
tag.cart.add({
    product: {
        category1: '1[Computers_and_Networking]',
        productId: '250[laptop]',
        quantity: 2,
        unitPriceTaxIncluded: 100,
        unitPriceTaxFree: 80,
        discountTaxIncluded: 15,
        discountTaxFree: 12,
        promotionalCode: 'promotional_code'
    }
});
tag.dispatch();

– In the case of a unit discount, like “10% off this product, no matter the quantity ordered”, you must apply the discount based on the quantity of products ordered.

var tag = new ATInternet.Tracker.Tag();
// set page
tag.page.set({
    name:'pageName'
});
// set order 
tag.order.set({...}); 
// set order content
tag.cart.set({cartId: 8235});
tag.cart.add({
    product: {
        category1: '1[Computers_and_Networking]',
        productId: '250[laptop]',
        quantity: 2,
        unitPriceTaxIncluded: 100,
        unitPriceTaxFree: 80,
        discountTaxIncluded: 20,
        discountTaxFree: 16,
        promotionalCode: 'promotional_code'
    }
});
tag.dispatch();
 

Appendix : tagging rules

  • Avoid “space”-type special characters and accented letters.
  • If one of the text fields contains a space, the hit is ignored.
  • Field labels should not contain special characters. If a label already exists for a given ID, the labels encoutered afterwards will not be saved.
  • The product IDs are mandatory.
  • The product category IDs are optional. They are unique, on the contrary to sub-category IDs which can be used several times with a distinct label.If you do not enter a label in the category (ID only), the name that will show up in the interface will be “#ID”.
  • ID and Label size:
    • Order reference: 50 characters.
    • Product category (‘ID[category_label]’)
      • ID: integer up to 10 digits.
      • category_label: category name up to 150 characters.
    • Product ID (‘ID[product_label]’)
      • ID: alphanumeric reference up to 50 characters.
      • product_label: product name up to 150 characters.
    • All totals entered in the tagging are truncated to 2 figures after the separator and are considered valid if they are inferior to 999,999,999.99. Beyond this, the entered total will be considered as equal to 0.
Was this post helpful?
Yes
No
Last update: 16/02/2018