Installing the transaction tag

In AB Tasty, you have the option to save the data related to the transactions carried out on your site (for example: Total number of transactions, average basket value, number of products ordered, etc.).

/* The following section is optional and saves information relating to the transaction in key/value format. Call up this function for each item of information to save */window._abtasty.push(["eco", "KEY","VALUE"]);</script>

Modify the settings with your own data

Tag composition

The transaction tag is made up of two parts: the first one that allows you to retrieve transaction-specific information and the second details the products purchased by the users.

GOAL NAME: the name you want to give to your transaction objective. The name of this objective must be sent as a string, i.e. in double quotation marks (ex: "Purchase").

ORDER ID: the unique identifier of the transaction generated by your back office. This is a string of characters (ex: "12345").

TRANSACTION VALUE: the amount of the order. This can be an amount with or without tax, with or without delivery charges, depending on the type of data you want to see in the reports. This is a string of characters (ex: "123.45").

ITEMS QUANTITY: the number of products purchased during the order. This is an integer (ex.: "20").

If your transaction tag has been set up in a version of the framework earlier than 2.1, you must manually change the tag in the source code and add the ITEMS QUANTITY variable yourself.If you do not have this variable, you will not have the Average Quantity and Average Item Price indicators.

The second part allows you to record other transaction-related information. You should use the same javascript method as before but with the first parameter modified.

<KEY> represents a label for the element that you want to record. This is a string of characters.

<VALUE> is the value that corresponds to the key. It must be a string of characters i.e. in single or double quotes.

This system of key/value pairs is fully customizable, allowing you to send AB Tasty all kinds of transaction related information that you will be able to access in your back office.

You can also send data related to each element involved in the transaction. For example, if a JavaScript table (herein referred to as MyProducts) contains the list of purchased products and their identifier and category, you can browse this table and send each value to AB Tasty as follows:

All of these JavaScript instructions must be put in place on your purchase confirmation page, after the AB Tasty tag, but you can use the AB Tasty tag to automatically inject them. This way, you will not have to modify your pages' source code.

For this,

Go to the Dashboard

Click on Settings, then Global Code

Paste the transaction tag into the JavaScript code editor.This will allow you to add code that will be applied to all pages that contain the AB Tasty tag. You can then define the code to be injected into your order confirmation page.

The following example is given for information only and must be adapted to your situation. In addition, it supposes that the data to be send is available in a javascript variable called dataLayer, which is often used if you use a tag manager, such as Google Tag Manager.