how to use products array when creating custom event property? I want to extract products->name
Hi Laurynas, Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To extract the name (or title) from each product in the products array when creating a custom event property in Mixpanel, you can use the formula language provided in the custom properties feature. If your event property is structured like this (as in the Shopify integration example): js products: checkout.lineItems.map((item) => { return { product_id: item.id, title: item.variant.product.title, // ...other properties } })LBKSYou can use the MAP function in Mixpanel’s custom property formula bar to extract the title (or name) from each product object in the array. The syntax would look like: LBKSMAP(properties.products, x -> x.title)LBKSThis will return a list of all product titles from the products array for each event.- If your property is called name instead of title, use x.name instead.
- You can use this formula in the custom property formula bar when creating or editing a custom property in Mixpanel.For more on parsing lists and objects in custom properties, see the documentation on Custom Properties: Calculate new properties on the fly.> The same syntax works with objects and lists, allowing you to parse out specific fields from arrays of objects in your event properties Custom Properties: Common Use Cases.If you do not see the MAP function or need more advanced parsing, use the formula bar’s autocomplete (Ctrl+Space) to explore available functions.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
