Product tags in customer events

Hi,

I am in the process of migrating to checkout extensibility for one of our Plus clients. They had a complex GTM setup that I can only partially replicate with the data available in the customer events.

Is there any way to access the product tags from the “checkout_completed” event? Alternatively, are there any plans from Shopify to make more data available in customer events?

Hi Rossella :waving_hand:

For the the “checkout_completed” event - is that specifically a GTM event or do you mean one of our webhook events like checkout/create?

Hi Liam :waving_hand:

I am referring to the standard events available with the customer pixels API. This is my setup for listening to the checkout_completed event - the client’s marketing team would also need the value of some specific product tags to be added to the item object, but this info is not available in the event properties

//triggered when the checkout is completed
analytics.subscribe("checkout_completed", (event) => {
  const checkout = event.data.checkout;
  const allDiscountCodes = checkout.discountApplications.map((discount) => {
      if (discount.type === 'DISCOUNT_CODE') {
        return discount.title;
      }
  });
  const lineItems = [];
  for (let index = 0; index < checkout.lineItems.length; index++) {
    const line = checkout.lineItems[index];
    const item = {
      item_name: line.title,
      item_id: line.variant.product.id,
      item_category: line.variant.product.type,
      item_sku: line.variant.sku,
      item_brand: line.variant.product.vendor,
      index: index,
      discount: line.discountAllocations[0]?.amount.amount,
      item_variant: line.variant.title,
      price: line.variant.price.amount,
      quantity: line.quantity
    }
    lineItems.push(item);
  }
  
  window.dataLayer.push({
    'event': 'begin_checkout',
    'pageType': 'Customer Information',
    'currency': checkout.currencyCode,
    'value': checkout.totalPrice.amount,
    'affiliation': checkout.lineItems[0].variant.product.vendor,
    'items': lineItems,
    'discountCodesUsed': allDiscountCodes,
    'fired_from': 'custom_pixel'
  });
});

Thanks for the added context Rossella - I’ve connected with the web pixels team on this to find out the best way to get product tags via the available events.

1 Like

HI Liam,

Following up on this, does the team know a way to get product tags via the standard events?

Thanks

Rossella

Does the checkout_completed event trigger properly for you after a successful purchase?