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":
- items
- value
- transaction_id
- orderItem
Step 2: Create the following Triggers in GTM as Custom Event triggers with the exact "Event name":
- tws-article-added
- tws-purchase
Step 3: Add two Tags with "Tag type" set to "Custom HTML":
-
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> -
Cart tracking tag that uses the "tws-article-added" Trigger as the "Firing Triggers":
Step 4: Submit and publish your GTM container to make the changes live.