Step 1 - Integrate Tracking Snippet
If you deal with single-page applications (SPAs), please carefully read this article first.
Adding the JavaScript snippet to your web pages is the quickest way to start passing data to Adtriba.
Replace YOUR_PROJECT_TRACKER_ID with the Tracker IDs provided by Adtriba.
Integrate this snippet into all Websites and all Webview App Pages.
Copy and paste this snippet just right before the </head> HTML-tag.
Cross-Domains: If the shop flow on your website entails domain switches please use our cross-domain basic snippet.
If you are using a TCF v2.0 standardized CMP please use the snippet from this article instead.
<script type="text/javascript">
(function(){
var id = "adtriba-js";
var init = document.getElementById(id);
if (!init) {
var a = document.createElement("script");
var s = document.getElementsByTagName("script")[0];
a.setAttribute("data-project-tracker-id", "YOUR_PROJECT_TRACKER_ID");
a.type = "text/javascript";
a.async = true;
a.id = id;
a.src = "https://cdn.adtriba.com/v2/adtriba.js";
s.parentNode.insertBefore(a, s);
}
window.adtriba = window.adtriba || [];
window.adtriba.push(["pageview"]);
})();
</script>
Step 2 - Track Conversions
For the marketing performance report, it is necessary to track conversions. Place this JavaScript snippet on the "Order Confirmation" or "Thank You" pages, on all websites + app webview.
The basic tracking snippet (Step 1) needs to be executed alongside.
id: Is mandatory and the conversion ID
revenue: Is optional but recommended
currency: optional but recommended
You can choose the conversion name by changing the field ‘order’ to any other name (like transaction).
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["conversion", "Transaction", {
id: "ABCDE123456",
revenue: "49.99",
currency: "EUR"
}]);
</script>
Step 3 - Identify Users
Use this snippet to identify the user by its unique ID (e.g. database ID or email). We’d recommend implementing the ID which is used internally and across platforms (web + app). Trigger this snippet after the user signed up or logged in, or on all pages with potential User ID availability (Website + App Webview).
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["identity", "john.doe@example.com"]);
</script>
You can also provide an encoded ID. In this example, we encoded john.doe@example.com with the SHA-256 hash function (We’d recommend a SHA-256 hashing algorithm + Salt).
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["identity", "836f82db99121b3481011f16b49dfa5fbc714a0d1b1b9f784a1ebbbf5b39577f"]);
</script>
Step 4 - Enhanced Ecommerce Events
The micro events do help the attribution algorithm to understand which touchpoints increased the conversion probability the most in a customer journey. It often happens that not the one who came last or first was the one with the most impact, but the one which drove the user into the highest product engagement.
Please note: the event names should not be changed as we can only process them only with the exact same naming stated below.
Products Searched
To be integrated on a product searched event
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["track", "ProductsSearched"]);
</script>
Product Viewed
To be integrated on a product detail view
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["track", "ProductViewed"]);
</script>
Product Added
To be integrated on a 'add to card' event
<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["track", "ProductAdded"]);
</script>