AB Tasty lets you save the data related to transactions made on your website (e.g. transaction amounts, payment methods, number of items purchased, etc.), along with information related to the purchased items (average cart value, item price, etc.).
This data is available in the reports of each campaign in the form of indicators or filters. For more on this, refer to New reporting: transaction indicators and e-commerce data.
To send transaction data to AB Tasty and display it in the reports, you need to add the transaction tag to your purchase confirmation page after the generic AB Tasty tag. You can implement the transaction tag in 3 different ways.
Once the transaction tag is implemented on your website, you can go ahead and run the QA process. For more information, refer to QA the transaction tag.
Accessing the transaction tag
- Go to the AB Tasty dashboard.
- Click , then click Settings>Tags implementation>Transaction tag.
- Click Copy to clipboard and paste the code into the purchase confirmation page.
- Change the settings based on your own data.
The transaction tag features two parts: the first enables the transmission of information related to the transaction (ID, name, amount, delivery fees, etc.) and the second enables the transmission of item or product details related to purchases made by customers visiting your website.
The transaction settings coincide with the general information related to a purchase. If necessary, this information can be enriched with settings related to items.
The tid, ta, tr and icn settings must be declared during transaction tag implementation. The other settings are optional, however we recommend configuring them also in order to be able to apply the matching filters in the reports later on.
|tid||Transaction ID||Coincides with the transaction ID.||tid: "OD564"|
|ta||Transaction affiliation||Coincides with the name assigned to the transaction as it will appear in the list of goals to configure.||ta: "Purchase"|
|tr||Transaction revenue||Coincides with the transaction amount. Includes taxes and delivery fees.||
|ts||Transaction shipping||Coincides with the delivery fees due.||ts: 3.5|
|tt||Transaction tax||Coincides with the taxes due.||tt: 2.60|
|tc||Transaction currency||Coincides with the currency used during the transaction.||tc: "EUR"|
|tcc||Transaction coupon code||Coincides with the discount coupon used during the transaction.||tcc: "Coupon"|
|pm||Payment method||Coincides with the payment method used during the transaction.||pm: "Paypal"|
|sm||Shipping method||Coincides with the delivery type.||sm: "Fedex"|
|icn||Item count number||Coincides with the total number of items purchased during the transaction.||icn: 12|
Information related to the transaction amount and the currency is collected, however no currency conversion is applied. The values are displayed in the report just as they are collected on the websites.
Information related to the purchased items can be linked to each transaction. In order to do this, you need to configure the “item” section of the transaction tag using the settings below in addition to those related to the transaction.
The tid and in settings must be declared. In particular, the tid setting must match the one declared for the main transaction.
|tid||Transaction ID||Coincides with the transaction ID.||tid: "OD564"|
|in||Item name||Coincides with the item name.||in: "Shoe"|
|ip||Item price||Coincides with the item price.||
|iq||Item quantity||Coincides with the number of times an item was purchased during the transaction.||iq: 4|
|ic||Item code||Coincides with the item’s CKU (stock-keeping unit), i.e. the item’s reference code used for stock management.||ic: "SKU47"|
|iv||Item category||Coincides with the category the item belongs to.||iv: "Blue"|
Ways of implementing the tag
The transaction tag can be implemented in 3 different ways:
- We recommend implementing the transaction tag in the source code of your website’s purchase confirmation page, as detailed above. Check our example.
- You can also implement the tag via a Tag Management System (TMS), which enables you to declare the transaction settings as well as settings related to items. For more on this, refer to Recommendations when implementing via a Tag Management System.
Example of code implementation
The best way to implement the transaction tag is within the source code of your website’s purchase confirmation page. You can use the code template provided below.
To implement the transaction tag, apply the following steps:
1. Copy all of the code below and paste it into your confirmation page.
This is the generic transaction tag and the variables are specific to your website.
// transaction tag
tid: __TRANSACTION_ID__, // Format: STRING, value example: “OD564"
ta: __TRANSACTION_NAME__, // Format: STRING, value example: “Purchase”
tr: __TRANSACTION_REVENUE__, // Format: FLOAT, value example: 15.47
ts: __TRANSACTION_SHIPPING__, // Format: FLOAT, value example: 3.5
tt: __TRANSACTION_TAXES__, // Format: FLOAT, value example: 2.60
tc: __TRANSACTION_CURRENCY__, // Format: STRING, value example: “EUR”
tcc: __TRANSACTION_COUPON_CODE__, // Format: STRING, value example: “Coupon”
pm: __TRANSACTION_PAYMENT_METHOD__, // Format: STRING, value example: “Paypal”
sm: __TRANSACTION_SHIPPING_METHOD__, // Format: STRING, value example: “Fedex”
icn: __TRANSACTION_ITEM_COUNT_NUMBER__ // Format: INTEGER, value example: 12
// transaction items tag
“tid”: __TRANSACTION_ID__, // Format: STRING, value example: “OD564”
“in”: __TRANSACTION_ITEMS[i].ITEM_NAME__, // Format: STRING, value example: “Shoe”
“ip”: __TRANSACTION_ITEMS[i].ITEM_PRICE__, // Format: FLOAT, value example: 3.5
“iq”: __TRANSACTION_ITEMS[i].ITEM_QUANTITY__, // Format: INTEGER, value example: 4
“ic”: __TRANSACTION_ITEMS[i].ITEM_CODE__, // Format: STRING, value example: “SKU47”
“iv”: __TRANSACTION_ITEMS[i].ITEM_CATEGORY__ // Format: STRING, value example: “Blue”
2. Replace the __TRANSACTION_XXX__values with your own data, available in your source code or datalayer.
3. Apply the appropriate format to your values (string, float or integer) as described in our developer portal.
4. Create a loop in the code so that it is triggered as many times as there are items in the transaction.
For Transaction Items, the key/value pair is unique to each item of the transaction.
If the transaction includes more than one item, the Transaction Items must be sent as many times as there are items in the transaction.
The Transaction Items must be sent independently for each item.
Recommendations when implementing in the source code
- The names of transaction and item parameters must not be changed.
- When replacing the `__TRANSACTION_XXX__` values, do not keep the opening or the closing double underscore `__` before and after.
- There should always be a comma `,` at the end of each line (except for the last line, for which it is not mandatory).
- Never place double “ ” or single ‘ ’ quotes around the value of the in parameter, even if the expected format of the value is a string.
- Implement the transaction tag at the bottom of the page - far after the generic tag. The transaction tag does need to be triggered after the generic tag but placing it at the bottom of the page will ensure the generic tag has fired already and that all values the transaction tag relies on have loaded as well.
Recommendations when implementing via a Tag Management System
- Always implement the generic tag in first position at the top of the page, then execute it.
- Implement the transaction tag at second position, i.e after the generic tag.
Otherwise, the `AB Tasty is undefined` error message will be displayed.