Installing the transaction tag
Last updated
Was this helpful?
Last updated
Was this helpful?
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 .
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 .
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.
Parameter name
Meaning
Definition
Example
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.
tr: 15.47
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.
Parameter name
Meaning
Definition
Example
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.
ip: 3.5
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"
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.
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.
2. Replace the __TRANSACTION_XXX__values with your own data, available in your source code or datalayer.
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.
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.
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.
Related articles
For more on the JavaScript implementation of transaction settings, please refer to our .
For more on the JavaScript implementation of settings related to items, please refer to our .
Finally, you may use the AB Tasty tag to automatically inject JavaScript instructions into your purchase confirmation page. In this case, you will use the Global Code functionality and won't need to modify your pages’ source code. For more on this, refer to .
3. Apply the appropriate format to your values (string, float or integer) as described in our .