Transaction events (Sales Insights)



This tagging documentation only applies to Tracker from version 2.13.0.

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);

For versions prior to version 2.14.0 (since version 2.11.0), the Ecommerce collection domain must be entered via the “collectDomain” configuration variable:

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

From version 2.14.0, it is no longer necessary to indicate this domain; the domain used will be the same as the one configured for the Tracker.

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


Transaction confirmation

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

  • An ECommerceCart-type cart
  • Shipping data in an ECommerceShipping-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 transaction’s properties should be declared as a HashMap-type collection, with different keys:

  • “id” – String: Transaction ID (mandatory).
  • “promocode” – ArrayList : Promotional code table including one or several codes. A promotional code is declared as a label.
  • “firstpurchase” – Boolean: First customer purchase (0 for no; 1 for yes).

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.

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.).
  • “$” – 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 add a screen as a parameter on initializing the transaction. The page should also be declared as a main goal.


Tracker tracker = ATInternet.getInstance().getDefaultTracker();
// With SalesTracker
tracker.Ecommerce().setAutoSalesTrackerEnabled(true, null, true);
Screen myScreen = tracker.Screens().add("transaction");
TransactionConfirmation tc = tracker.Ecommerce().TransactionConfirmations().add(myScreen);
// Without SalesTracker
//tracker.Ecommerce().setAutoSalesTrackerEnabled(false, null, true);
//TransactionConfirmation tc = tracker.Ecommerce().TransactionConfirmations().add();
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().setAll(new HashMap<String, Object>(){{
    put("id", "27");
    put("promocode", new ArrayList<String>() {{
    put("firstpurchase", 0);
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.Products().add(new ECommerceProduct(new HashMap<String, Object>() {{ 
    put("id", "1"); 
    put("variant", "1"); 
    put("$", "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");

You may use the independent method “tracker.Events.send()” in order to send only your Ecommerce data.


Transaction confirmation on server-side

You can validate a cart awaiting payment event by generating a HTTP GET call on server-side:

https://collect-euw1.YOURDOMAINLOG/hit.xiti?s=XXXXX&col=2&events=[{"name":"transaction.confirmation","data":{"cart_id":"XXXXX", "transaction_id":"XXXXX", "offsite_confirmation":true}]&rdt=off

In this call, you must replace values XXXXX by :

  • the site number concerned by the transaction:
  • the cart ID to be validated:
  • the transaction ID:



Configuration variables

NameDefault valueDescriptionVersion
collectDomain“”Sales Insights collection domain >= 2.11.0
autoSalesTrackerfalseEnable automatic measurement of SalesTracker order content upon a transaction confirmation event >= 2.11.0

Cet article a-t-il été utile ?

Last update: 04/03/2020