Transaction events (Sales Insights)



If you can’t see the “Sales Insights” menu entry in Explorer, please get in touch with us so we can activate this for you.


Transaction event

With the tracker, an ECommerce object is available, exposing different objects and methods useful for measuring transaction confirmation.

Additionally, it’s possible to enable automatic tagging of SalesTracker orders by overriding the “autoSalesTracker” configuration variable:

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
tracker.ECommerce().setAutoSalesTrackerEnabled(true, null, true);

The Sales Insights collection domain must be indicated via the “collectDomain” configuration variable:

tracker.ECommerce().setCollectDomain("collect-euw1", null, true);

See the full list of Ecommerce configuration variables that can be overridden at the end of this page.


Transaction confirmation

Measuring transaction confirmations is done by creating a TransactionConfirmation object, to which the following can be associated:

  • A list of PromotionalCodes-type promo codes
  • An ECommerceCart-type cart
  • Client data in an ECommerceCustomer-type object
  • Shipping data in an ECommerShipping-type object
  • Payment data in an ECommercePayment-type object
  • Transaction data in an ECommerceTransaction-type object
  • A list of products, Products, which can contain one or several ECommerceProduct.-type products.

A cart’s properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Cart ID.
  • “currency” – String: Currency.
  • “turnoverTaxIncluded” – Float: Total amount of cart, including tax (shipping costs included).
  • “turnoverTaxFree” – Float: Total amount of cart, excluding tax (shipping costs included).
  • “creation_utc” – Date: Date of creation of the cart (timestamp UTC in seconds).
  • “quantity” – Number: Total number of products in the cart.
  • “nbDistinctProduct” – Number: Number of distinct products in the cart.

A promotional code should be declared as a label/name.

The transaction ID should be declared in a property:

  • “id” – String: Transaction ID (mandatory).

Delivery data should be declared as a HashMap-type collection, with different keys:

  • “delivery” – String: Name of shipping company.
  • “costTaxIncluded” – Float: Amount of shipping costs, including tax.
  • “costTaxFree” – Float: Amount of shipping costs, excluding tax.

Payment method should be declared in a property:

  • “mode” – String: Payment method.

Client data should be added in a property:

  • “new” – Boolean: New client (0 for no; 1 for yes).

A product’s properties should be declared in a HashMap-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “name” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product (0 for no; 1 for yes).
  • “priceTaxIncluded” – Float: Price, including tax.
  • “priceTaxFree” – Float: Price, excluding tax.
  • “currency” – String: Currency.
  • “stock” – Boolean: Product in stock (0 for no; 1 for yes).
  • “quantity” – Number: Number of products in the cart.
  • “category1” – String: The product’s level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).

If you use double tagging with SalesTracker, you will need to declare the confirmation page as a main goal.


Tracker tracker = ATInternet.getInstance().getDefaultTracker();
Screen screen = tracker.Screens().add("transaction");
TransactionConfirmation tc = tracker.ECommerce().TransactionConfirmations().add(screen);
tc.Cart().setAll(new HashMap<String, Object>() {{
    put("id", "34");
    put("creation_utc", 1514973161); //UTC timestamp in seconds
    put("turnoverTaxFree", 447.76); //Shipping fees included + discount 8€44
    put("turnoverTaxIncluded", 547.4); //Shipping fees included + discount 10€
    put("nbDistinctProduct", 1);
    put("quantity", 1);
    put("currency", "EUR");
tc.Transaction().set("id", "27");
tc.Shipping().setAll(new HashMap<String, Object>() {{
    put("costTaxFree", 7);
    put("costTaxIncluded", 8.4);
    put("delivery", "My carrier");
tc.Payment().set("mode", "Credit card");
tc.Customer().set("new", 0);
tc.Products().add(new ECommerceProduct(new HashMap<String, Object>() {{ 
    put("id", "1"); 
    put("variant", "1"); 
    put("name", "laptop_A56"); 
    put("brand", "ACER"); 
    put("discount", 1); 
    put("priceTaxIncluded", 549); 
    put("priceTaxFree", 456.2);
    put("currency", "EUR");
    put("stock", 1);
    put("quantity", 1);
    put("category1", "Computers_and_Networking"); 
    put("category2", "Computers"); 
    put("category3", "Laptops");

Declaring and adding a screen are necessary for SalesTracker order tagging.




Configuration variables

Name Default value Description Version
collectDomain “” Sales Insights collection domain  >= 2.11.0
autoSalesTracker false Enable automatic measurement of SalesTracker order content upon a transaction confirmation event  >= 2.11.0

Was this post helpful?

Last update: 08/01/2019