Solved

Can you query against nested event properties?

  • 14 October 2021
  • 2 replies
  • 1250 views

With data coming into Amplitude from Segment, I have an event that tracks orders that looks like the below example.

analytics.track('user@email.com', 'Order Completed', {
'email': 'user@email.com',
'order_id': '12345',
'platform': 'Website',
'products': [
{
'category': 'Soap',
'price': 4.99,
'sku': 'SP-SML'
}
],
'sales_channel': 'Website',
'shipping': 0.0,
'total': 4.99
})

Is it possible to create a chart that can then track the different Category values here? Bearing in mind it is possible for one of these events to have multiple products in it.

icon

Best answer by belinda.chiu 15 October 2021, 00:09

View original

2 replies

Userlevel 7
Badge +10

Hey @edparry 

In most of such cases, Amplitude will stringify the nested json and querying the individual key becomes an issue.

Here are a few posts which can help you understand this issue better and get around a possible solution - 

 

Hope this helps!

Userlevel 6
Badge +8

Hi @edparry ! Welcome to the Amplitude Community! :wave_tone1:

I noticed you mentioned you are sending this data from Segment in which I found that “All event properties, except products, are sent as event_properties of the Amplitude “Order Completed” event. Information about each product is present only on the individual “Product Purchased” events.” https://segment.com/docs/connections/destinations/catalog/amplitude/#order-completed

Since the “category” property that you are referring to is under the “products” field, this “category” property should then be found under the Products Purchased events in which you can then create a chart looking at the category values for Products Purchased! 

Reply