Hi, hope everyone is well.
Issue: GTM server purchase tag FAILED to fire.
Video Link to the issue:https://www.loom.com/share/638e4b6cb0704f818d5e4788e11a2666?sharedAppSource=personal_library
Shopify by default measures the purchase event using CAPI. however, I wanted to track the CAPI purchase event for a different FB pixel. Therefore, I took the Github code of GTM-server for Shopify and modify it to capture the purchase event.
if (type === "Purchase") {
dataLayer.push({
event: type === "Purchase" ? "CAPI Purchase" : "Failed",
event_id: eventId,
price: parseInt(data["cd[value]"]),
orderIds: data["cd[content_ids]"],
itemCount: data["cd[num_items]"],
currency: data["cd[currency]"],
contentType: data["cd[content_type]"],
customer_id: ShopifyAnalytics.meta.page.customerId
? ShopifyAnalytics.meta.page.customerId
: "",
});
}
The code mentioned above works fine, it captures the data and sends it to the GTM server. Although everything looks fine on the server, the GTM server is failing to fire the purchase event, The error says
“code”:100,
“error_subcode”:2804009,
This is my GTM web container tag
This is my GTM server container tag
Hope the information provided was sufficient
-Hassan