Use Heap’s client-side track API and addEventProperties API to send arrays—such as lists of items, tags, or categories—as values for event properties in Heap.
This can help you answer questions such as:
- Which blog post category receives the most views?
- Which item is purchased the most?
- Which users purchased both item X and item Y?
Array properties can be used to filter and group data in Usage over time and Engagement analysis. You can also use them in Funnels where you’re holding a property constant.
Examples
Let’s say you have an event named “Purchase” with an array property named “items”.
heap.track('Purchase', {items: ['socks', 'shoes', 'shirt']});
In Heap, set the Data type on your array property from Auto-detect to Array to access the data as an array instead of a string.
Usage over time
Array properties can be used to group total events, unique users, number of sessions, and property aggregation queries. Grouping by array properties isn’t supported for Conversion rate or Retention rate charts.
To see your customer’s purchases broken down by item totals, you can look at the number of purchases grouped by items.
Funnels
A funnel with an array property-held constant can be grouped by that same array property. Array properties won’t work for funnels without a property-held constant.
To see the conversion rate of how many of an item were added to cart vs. purchased, hold the “items” property constant and group by “items” as well.
This shows us the conversion rate for each item in our array.
Limitations
- Arrays are only supported for event properties, not user properties
- Grouping by array properties is only available for Usage over time, Engagement, and property-held constant Funnels where the property held constant and the group by are the same array property
- Grouping by array properties isn’t supported for Conversion rate or Retention rate charts within Usage over time analysis.
- In the chart builder, array properties can be selected anywhere that event properties can be selected. In places they aren’t explicitly supported, they’ll be treated as strings and the delimiters will be visible in the results
- In filters, all operators for array properties operate on the serialized delimited string. We don’t currently support any array-specific operators