GTM Purchase Tracking Issue - Shopify Sending a send_to parameter on purchase event...

I couldn’t get GTM to track a purchase in GA4 on Shopify and I have worked out why but unsure how to resolve it…

I have the following code in a custom pixel to track purchases and push to GTM…

analytics.subscribe("checkout_completed", (event) => {
  dataLayer.push({ ecommerce: null });
  const items = event.data?.checkout?.lineItems?.map((item) => {
    return {
      item_id: item.variant.product.id,
      item_name: item.variant.product.title,
      price: item.variant.price.amount,
      quantity: item.quantity
    }
  });
  dataLayer.push({
    event: "purchase",
    url: event.context.document.location.href,
    ecommerce: {
      currency: event.data?.checkout?.currencyCode,
      value: event.data?.checkout?.subtotalPrice?.amount,
      transaction_id: event.data?.checkout?.order?.id,
      coupon: event.data?.checkout?.discountAllocations,
      shipping: event.data?.checkout?.shippingLine?.price?.amount,
      tax: event.data?.checkout?.totalTax?.amount,
      items: items
    }
  });
});

However when we view this purchase in the GTM we can see that it is adding a send_to parameter which forces it to send to the Merchant Center and ignore all other triggers set out in GTM. How do we avoid this so we can correctly track purchases in GA4 and Google Ads?

1 Like

your datalayer is not compatible for custom pixel to push datalayer event for purchase event.

you need a latest comprehensive datalayer which will push all ecommerce events from view item to purchase.

Currently it is seen a datalayer generated by google app which follows UA schema.

Here is the example of latest datalayer to push all events and tracking through Google tag manager GTM