This article helps you:
Unlock new insights by analyzing Amplitude data as object arrays
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 (for example, 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 set everything up, you have access and analyze these object arrays from within your chart.
Likely use cases include:
Cart Analysis is available for Amplitude's Event Segmentation and Funnel Analysis charts.
This feature is in an open beta and only available to users on Growth and Enterprise plans. See Set up property splitting to get started.
Here's a brief overview of the more important ideas that make cart analysis work:
products
is the object array that holds two distinct objects. 1{ 2 "products": [ 3 { 4 "product_id": 1, 5 "sku": "45360-32", 6 "name": "Special Facial Soap", 7 "category": "beauty", 8 "price": 12.6 9 },10 {11 "product_id": 5,12 "sku": "47738-11",13 "name": "Fancy Hairbrush",14 "category": "beauty",15 "price": 18.916 }17 ]18}
products
.sku
and price
are two examples of child properties. These are limited to one level of nesting.sku
and price
are sibling properties.Child properties count toward your property volume counts.
Property splitting must be enabled before you can use object arrays for cart analysis. You can complete the process in Amplitude Data.
Only project managers and admins can enable splitting. Portfolio projects don't support splitting.
To enable property splitting, follow these steps:
products
.)If you're using Amplitude Data, you may need to add the event you're interested in to your tracking plan.
Type
to Array
and set Item type
to Any
. The Splitting tab displays on the right.To stop splitting, go to the Splitting tab and click Stop Splitting.
This change takes effect for any net new data ingestion. Data persists for previously split events.
You have two options for sending the cart object array. The first is to use either the set()
or append()
method with the Identify API:
1const identifyEvent = new amplitude.Identify(); 2 3// can use either set() or append() 4identifyEvent.append('products', [{ 5product_id: 123, 6sku: '41245', 7name: 'Sunscreen' 8}]); 9 10amplitude.identify(identifyEvent);
The second is to send it as event properties:
1const myCartObjectArray = {"products": [{2product_id: 123,3sku: '41245',4name: 'Sunscreen'5}]};6 7amplitude.logEvent("Product Viewed", event_properties=myCartObjectArray)
To learn more, see the Identify API.
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 {:}
:
As with standard event and user properties, you can apply conditions to filter your results. Filters work a little differently for object arrays.
contains
clauses on the same item or object.You can only apply parallel semantics on sibling properties.
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.
Thanks for your feedback!
December 6th, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.