kapa.ai I'm sending purchase data to Mixpanel with a products array like this: json
"products": [
{
"brand": "Bioderma",
"name": "Atoderm Intensive Eye",
"taxValueLC": 17.94,
"quantity": 1
},
{
"brand": "dr. Irena Eris",
"name": "eris wash gell solution",
"taxValueLC": 18.51,
"quantity": 2
}
]Two questions:
Is this structure appropriate for Mixpanel analytics?
What's the correct custom formula to calculate total tax value across all sold units (taxValueLC × quantity for each product)?
1. **Is this structure appropriate for Mixpanel analytics?**Yes, Mixpanel supports sending event properties as arrays of objects (like your products array). According to the documentation, Mixpanel accepts arbitrary JSON as properties, including objects and lists. This means your structure is valid and can be ingested by Mixpanel for analysis. However, keep in mind that while you can send arrays of objects, some advanced features (like profile history) do not support object-type properties, and certain analyses may require you to flatten or extract values from these objects for easier aggregation or segmentation Docs: Events and Properties FAQ.2. What's the correct custom formula to calculate total tax value across all sold units (taxValueLC × quantity for each product)?Summary:
- Your products array structure is supported by Mixpanel.
- To calculate total tax value across all sold units, pre-calculate the sum (taxValueLC × quantity for each product, summed across the array) and send it as a separate property with your event. Mixpanel’s custom properties do not natively support array iteration or aggregation within a single event property Docs: Custom Properties.If you need to analyze or break down by product attributes, Mixpanel’s Cart Analysis feature can help, but for aggregate calculations like total tax value, pre-calculation is necessary Mixpanel Ecommerce Analytics.
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.
