Amplitude's cart analysis feature enables you to analyze data sent as object arrays. This can be particularly useful for behavioral insights into e-commerce transaction and shopping cart flows. You can analyze search results or cart events in the aggregate (e.g., total order volume or co-occurrence), or you can segment your analyses by dimensions such as brand, category, price, or SKU, among others.
Once you've set everything up, you'll be able to access and analyze these object arrays from within your chart.
NOTE: Cart analysis is currently in an open beta. If you'd like to participate and are on a Growth or Enterprise plan, see Set up property splitting to get started.
Likely use cases include:
- Product performance (volume) by attribute (SKU, category, brand)
- Conversion rates by product type (or another attribute)
- Top-performing product combinations that reveal opportunities for cross-selling
- Revenue/business outcomes performance by item/product
- Average basket size or item count
Cart Analysis is available for Amplitude's Event Segmentation and Funnel Analysis charts.
Terms and concepts
Here's a brief overview of the more important ideas that make cart analysis work:
- Object array: This is a data format that can store a collection of distinct objects under a single name. In an Amplitude context, the array itself acts as an event or user property, while the objects it contains are item-specific attributes or properties. In the example below,
products
is the object array that holds two distinct objects.
products: [
{
product_id: 1,
sku: '45360-32',
name: 'Special Facial Soap',
category: 'Beauty',
price: 12.60,
},
{
product_id: 5,
sku: '47738-11',
name: 'Fancy Hairbrush',
category: 'Beauty',
price: 18.90,
}
]
- Parent property: This is the top-level event or user property that contains an array of objects; in the example above, this is
products
. - Child property (or item property): These are the nested attributes within the array of objects; these are what Amplitudes splits out for its analyses. In the example above,
sku
andprice
are two examples of child properties. These are limited to one level of nesting. - Sibling property: These are two or more child properties tied to the same parent event or user property. In the example above,
sku
andprice
are sibling properties. -
Property splitting: This is the processing method Amplitude uses to split out nested child properties from parent properties in your data, after ingestion has occurred. The property splitting process will preserve the parent properties.
NOTE: Child properties count toward your property volume counts.
Set up property splitting
Property splitting must be enabled before you can use object arrays for cart analysis. You can complete the process in Amplitude Data.
NOTE: Only admins can enable splitting.
To enable property splitting, follow these steps:
- Open Amplitude Data.
- Find the event or user property you want to use as a parent property and select it. (In the example used above, this is
products
.)
NOTE: If you're using Amplitude Data, you may need to add the event you're interested in to your tracking plan. - In the property drawer, open the Splitting tab.
- You'll see a preview of what the splitting process would deliver. If it's acceptable, click Start Splitting.
To stop splitting, retrace steps 1-3 and click Stop Splitting.
This change will take effect for any net new data ingestion. However, data will persist for previously split events. To learn more about hiding or deleting split properties, see our article on managing events in Amplitude.
Use object arrays in your Event Segmentation and Funnel Analysis charts
As mentioned earlier, you can access the object arrays generated by the property splitting process from within your chart events—just like any other event or user property.
These arrays show up in the event / user property dropdowns and are designated by {:} :
Filters
As with standard event and user properties, you can apply conditions to filter your results. However, these filters work a little differently for object arrays.
- Cross-property filters (default): These filters point to or reference all items or objects within the array. This is also referred to as “mix and match” semantics. To apply cross-property filters, apply two separate clauses via + Filter by on the same event.
- Parallel filters: These filters point to or reference the same item or object within the array. To apply parallel filters, add two or more
contains
clauses on the same item or object.
NOTE: You can only apply parallel semantics on sibling properties. - Item match: Selecting this option tells Amplitude Analytics to respect filter conditions when displaying group-by values (for example, only electronics items).
- Collection match: Selecting this option tells Amplitude Analytics to reference all objects in the event when displaying group-by values (for example, all items in purchases containing electronics).
Examples of queries using object arrays for cart analysis
Object arrays are highly flexible tools and are capable of complex queries. Here are some examples of expected use cases for object arrays that may help you develop your own queries.
- Purchases containing an electronics product:
- Purchases containing an electronics product, where the price was greater than or equal to $24.99:
- Compare purchases containing seasonal products to purchases containing beauty products:
- Sum the price of electronics products in any purchases that contain at least one electronics product: