Skip to content

Tracking Carts & Conversions on Abicart / Textalk via Google Tag Manager

clock Avg. 2 min read

Tracking Carts & Conversions on Abicart / Textalk via Google Tag Manager

This guide explains how to track carts and conversions on the Abicart Textalk platform using Google Tag Manager.

Step 1: Ensure the following User-Defined Variables exist in GTM. Create each as a Data Layer Variable with the following "Name" and "Data Layer Variable Name":

  1. items
  2. value
  3. transaction_id
  4. orderItem

  

Step 2: Create the following Triggers in GTM as Custom Event triggers with the exact "Event name":

  1. tws-article-added
  2. tws-purchase

Step 3: Add two Tags with "Tag type" set to "Custom HTML":

  1. Conversion tracking tag that uses the "tws-purchase" Trigger as the "Firing Triggers":

    For Google Analytics 4

    <script>
      var productArray = [];
      var dynamicProductArray = {{ items }};
      for(i=0;i<dynamicProductArray.length;i++) {
          productArray.push(dynamicProductArray[i]["item_id"]);
      }
    
      hrq = window.hrq || [];
      hrq.push(["trackConversion", {
            total: "{{ value }}",
            orderNumber: "{{ transaction_id }}",
            productNumbers: productArray
      }]);
    </script>
    

  2. Cart tracking tag that uses the "tws-article-added" Trigger as the "Firing Triggers":

    <script>
      var basketItem = {{orderItem}};
      hrq = window.hrq || [];
      hrq.push(function() {
          ADDWISH_PARTNER_NS.api.cart.addProduct({
              productNumber: basketItem.articleNumber
          });
      });
    </script>
    

Step 4: Submit and publish your GTM container to make the changes live.