I have a custom integration, and for the Placed Order event, there is an array of Items. The data seems to be coming through ok (see example below), but I’m unable to see “Item” as a filter option.
My specific use case, is I want to be able to filter by by the Item.ProductID property of the items purchase in the event.
Example event (blurred some URLs):
As you can see in the above event, there is an array of Items that include ProductID, ImageURL, and other properties.
Trigger filter is missing “Item” filters, I can only filter by top level properties. Is this expected behavior? If not, how can I troubleshoot this?
Best answer by saulblum
You can only segment and filter on top-level properties of the JSON block.
You can add as many key/value pairs as you’d like to the JSON payload, with one restriction: you can only use top-level properties in the JSON when adding filters to segments based on this event (Added to Cart in this case). That is why there is a top-level property AddedItemCategories in the below example that is the union of unique ProductCategories values of each of the products in the Items array. With this top-level property, you can create a segment of profiles who have viewed products in specific categories.
Is `items` the name of a profile property on any profile in your Klaviyo instance?
There’s an annoying bug that has existed for many years where Trigger Splits will not show event properties if they’re also profile properties. This bug is detailed here:
You can add as many key/value pairs as you’d like to the JSON payload, with one restriction: you can only use top-level properties in the JSON when adding filters to segments based on this event (Added to Cart in this case). That is why there is a top-level property AddedItemCategories in the below example that is the union of unique ProductCategories values of each of the products in the Items array. With this top-level property, you can create a segment of profiles who have viewed products in specific categories.
Hi @cwdev, following up on what @saulblum stated, since Klaviyo only lets you filter on the root node of an event’s payload (and not into nested arrays), you can break out and create a separate “ProductIDs” with just an array of the various product IDs similar to how you did it with “ItemNames.” That should let you then filter by the specific ProductID. Let us know if that worked!