Step 1 - Integrate Tracking Snippet

Adding the JavaScript snippet to your web pages is the quickest way to start passing data to Adtriba.

Copy and paste this snippet just right before the </head> HTML-tag.

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.

<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). Trigger this snippet after the user signed up or logged in.

<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.

<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 touchpiont 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", {
query: "white shoes"
}]);
</script>

Product Viewed

To be integrated on a product detail view

<script type="text/javascript">
window.adtriba = window.adtriba || [];
window.adtriba.push(["track", "ProductViewed", {
id: "e931d37e-8ca8-41b0-b6f0-95cb59e90afd",
sku: "abcd1234",
category_id: "shoes",
brand: "Nike",
name: "Air Max",
currency: "USD",
price: "79.99"
}]);
</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", {
id: "e931d37e-8ca8-41b0-b6f0-95cb59e90afd",
sku: "abcd1234",
category_id: "shoes",
brand: "Nike",
name: "Air Max",
currency: "USD",
price: "79.99",
quantity: "1",
cart_id: "2770fb61-ecb1-4be4-9c68-ef5531ad6ce2"
}]);
</script>
Did this answer your question?