Transaction events

 

Foreword

This tagging documentation only applies to Tracker from version 2.16.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.

 

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).
  • “status” – String: Transaction status.
  • “promocode” – ArrayList : Promotional code table including one or several codes. A promotional code is declared as a label.
  • “firstpurchase” – Boolean: First customer purchase.

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.).
  • “article” – String: Additional level of detail for product variant.
  • “placement” – String: Product placement.
  • “promocode” – Array: Promotional code table including one or several codes. A promotional code is declared as a label.
  • “$” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product.
  • “pricetaxincluded” – Float: Price, including tax.
  • “pricetaxfree” – Float: Price, excluding tax.
  • “stock” – Boolean: Product in stock.
  • “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”).

Example

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
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("status", "charged");
    put("promocode", new ArrayList<String>() {{
                            add("DQQYRZSJ");
                            add("UN1ENE27");
                        }});
    put("firstpurchase", false);
}});
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("article", "21");
    put("placement", "homepage");
    put("promocode", new ArrayList() {{
                            add("AQQYRTGJ");
                        }}); 
    put("$", "laptop_A56"); 
    put("brand", "ACER"); 
    put("discount", true); 
    put("pricetaxincluded", 549); 
    put("pricetaxfree", 456.2);
    put("stock", true);
    put("quantity", 1);
    put("category1", "Computers_and_Networking"); 
    put("category2", "Computers"); 
    put("category3", "Laptops");
}}));
tracker.dispatch();

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://YOURSSLCOLLECTDOMAIN/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:
    ?s=XXXXX
  • the cart ID to be validated:
    "cart_id":"XXXXX"
  • the transaction ID:
    "transaction_id":"XXXXX"
Last update: 12/08/2020