When a transaction occurs on our ecomm site, we send one Purchase event to Amplitude. We have event properties such as product name, product sku, product brand, etc. If there are multiple products, the values are sent as an array. For example, if an order contains an Apple iPhone and a cell phone plan, the product name event property will come over as [Apple iPhone 11 Pro Max, 4GB Service Plan].
Our need is pretty simple and straightforward. I’d like to be able to query the Purchase event by product name. For example, I would like to see all Purchases that had either an Apple iPhone 11 Pro Max or a Samsung Galaxy S12.
After working with support, it is my understanding that I am not able to use the set contains operator to apply multiple filters to arrays. I would have to do the following instead:
Event 1: Purchase where product name set contains Apple iPhone 11 Pro Max
Event 2: Purchase where product name set contains Samsung Galaxy S12
Event 3: Purchase where product name set contains Apple iPhone 11 Pro Max, Samsung Galaxy S12
Then I will need to use the custom formula TOTALS(A)+TOTALS(B)-TOTALS(C).
I think my use case is pretty common, so I was surprised that there wasn’t a more straightforward solve. I can also see the individual events causing a headache when I want to look at Purchase events that include several specific items, not just 2. How are others approaching this? Are you sending the values as strings instead of arrays?
Thanks in advance!
Best answer by Saish RedkarView original