How to implement the Transaction tag
Last updated
Was this helpful?
Last updated
Was this helpful?
AB Tasty lets you save the data related to transactions on your website (e.g., transaction amounts, payment methods, number of 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. Please refer to the article for further information.
The first thing to know about the transaction tag is that it is not a tag itself (as the can be) but rather a revenue tracker that must be placed on the order confirmation page (checkout page).
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.
Please note that transactions will be linked to the campaign(s) the user has seen.
To learn more about transaction metrics, read .
For other question regarding the Transaction tag, .
There are 4 ways to implement the transaction tag:
Option 1 - which uses your dataLayer (Google Tag Manager, Tealium or CommandersAct to collect data (medium level of complexity)
Option 2: (advanced level of complexity - a developer is needed)
Option 3: (TMS - advanced level of complexity - a developer is needed)
Option 4: (one click activation) if you are using Shopify as your CMS.
To access the former method using our , please refer to this specific article.
Once the transaction tag is implemented on your website, you can go ahead and run the QA process. For further information, refer to .
It uses your dataLayer (Google Tag Manager, Tealium or CommandersAct) to collect transactional data.
Advanced Level of Complexity – A Developer is Needed
You can create and code your transaction script you will then integrate into your confirmation page’s source code or your Tag Management System (e.g GTM or Tag Commander).
The transaction tag features two parts:
the first part enables the transmission of information related to the transaction (ID, name, amount, delivery fees, etc.)
the second part enables the transmission of item or product details related to purchases made by customers visiting your website.
You can use the code template provided below.
Follow the steps below to implement the transaction tag:
Copy all of the code below and paste it into your confirmation page.
This is the generic transaction tag. Variables are specific to your website.
Replace the __TRANSACTION_[OBJECT]__values with your data, available in your source code or data layer.
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.
When implementing in the source code, we recommend the following:
the names of transaction and item parameters must not be modified;
when replacing the__TRANSACTION_[OBJECT]__ values, do not keep the opening or the closing double underscore `__`;
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 character string;
implement the transaction tag at the bottom of the page - far from the generic tag. The transaction tag does need to be triggered after the generic tag. However, 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.
When implementing via a Tag Management System, we recommend the following:
always implement the generic tag in the first position at the top of the page, then execute it.
implement the transaction tag in the second position, i.e after the generic tag. Otherwise, the AB Tasty undefined error message will be displayed.
This new method will replace progressively the .
For more information about how to use it, please refer to the following specific article :.
All the needed information is accessible in our
Apply the appropriate format to your values (string, float, or integer) as described in our .
For more information about how to implement the transaction tag with your Tag management System, please refer to , which is relative to the generic tag and the transaction tag set-up in Google Tag Manager.
The enables to set-up your generic tag and to send transactional events to AB Tasty such as the transaction tag does it. Please refer to .