Transaction Event (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.

 

Transaction Events

The plugin provides a function useful for measuring the confirmation of a transaction.

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.

 

Transaction confirmation

The Tracker has several declaration methods:

  • tag.ecommerce.transactionConfirmation.cart.set()
  • tag.ecommerce.transactionConfirmation.transaction.set()
  • tag.ecommerce.transactionConfirmation.shipping.set()
  • tag.ecommerce.transactionConfirmation.payment.set()
  • tag.ecommerce.transactionConfirmation.products.set()
  • tag.ecommerce.transactionConfirmation.discount.set() (deprecated since version 5.18.0)
  • tag.ecommerce.transactionConfirmation.customer.set() (deprecated since version 5.18.0)

Measuring transaction confirmation is done via declaring a cart object, a transaction object, a delivery object, a payment object and a product table.

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. (shipping incl.).
  • “turnovertaxfree” – Float: Total cart amount, tax excl. (shipping incl.).
  • “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.

The transaction is declared as an object that can have the following properties:

  • “id” – String: Transaction ID (this parameter is mandatory).
  • “promocode” – Array: 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).

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.

The payment method is declared as an object with the following property:

  • “mode” – String: Payment method.

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).
  • “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 in cart.
  • “category1” – String: Product’s level 1 category (up to 6 tree structure levels possible; from “category1” to “category6”).

If you are using Sales Tracker double tracking, you will need to declare the confirmation page as a goal page.

Example

var tag = new ATInternet.Tracker.Tag();
tag.ecommerce.transactionConfirmation.cart.set({
    "id": "34",
    "currency": "EUR",
    "turnovertaxincluded": 547.4, //Shipping fees included + discount 10€
    "turnovertaxfree": 447.76, //Shipping fees included + discount 8€44
    "creation_utc": 1514973161, //UTC timestamp in seconds
    "quantity": 1,
    "nbdistinctproduct": 1
});
tag.ecommerce.transactionConfirmation.transaction.set({
    "id": "27",
    "promocode": ["DQQYRZSJ", "UN1ENE27"],
    "firstpurchase": 0
});
tag.ecommerce.transactionConfirmation.shipping.set({
    "delivery": "My carrier",
    "costtaxincluded": 8.4,
    "costtaxfree": 7
});
tag.ecommerce.transactionConfirmation.payment.set({"mode": "Credit card"});
tag.ecommerce.transactionConfirmation.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.dispatch();

 

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.ati-host.net/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"
 

Appendices

 

Tagging methods

  • tag.ecommerce.transactionConfirmation.cart.set
  • tag.ecommerce.transactionConfirmation.transaction.set
  • tag.ecommerce.transactionConfirmation.shipping.set
  • tag.ecommerce.transactionConfirmation.payment.set
  • tag.ecommerce.transactionConfirmation.products.set
  • tag.ecommerce.transactionConfirmation.discount.set() (deprecated since version 5.18.0)
  • tag.ecommerce.transactionConfirmation.customer.set() (deprecated since version 5.18.0)
 

Setup variables

NameDefault valueDescriptionVersion
Ecommerce.collectDomain“”Sales Insights collect domain >= 5.13.0
Ecommerce.autoSalesTrackerfalseEnable automatic SalesTracker order content measurement on a transaction confirmation event >= 5.13.0
 

Was this post helpful?

Last update: 05/09/2019