Transaction Event

 

Foreword

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

 

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

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

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.).
  • “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: Product price, tax incl.
  • “pricetaxfree” – Float: Product price, tax excl.
  • “stock” – Boolean: Product in stock.
  • “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”).

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",
    "status": "charged",
    "promocode": ["DQQYRZSJ", "UN1ENE27"],
    "firstpurchase": false
});
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",
    "article": "21",
    "placement": "homepage",
    "promocode": ["AQQYRTGJ"],
    "$": "laptop_A56",
    "brand": "ACER",
    "discount": true,
    "pricetaxincluded": 549,
    "pricetaxfree": 456.2,
    "stock": true,
    "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://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"

It is recommended to encode the content of the parameter events, in order to ensure the correct transmission of information.

 

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

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

Last update: 12/08/2020