Re: Product tags in customer events

Product tags in customer events

RossellaF
Shopify Partner
28 0 6

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?

Replies 5 (5)

Liam
Community Manager
3108 340 871

Hi Rossella 👋

 

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

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

RossellaF
Shopify Partner
28 0 6

Hi Liam 👋

 

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'
  });
});

 

Liam
Community Manager
3108 340 871

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.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

RossellaF
Shopify Partner
28 0 6

HI Liam,

 

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

 

Thanks

Rossella

lynth
Shopify Partner
102 5 14

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

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!