Say my event looks like:
purchase = {
items: ["pickle", "turtle", "lexicon"]
}
How do I count how many events have "pickle"?
Say my event looks like:
purchase = {
items: ["pickle", "turtle", "lexicon"]
}
How do I count how many events have "pickle"?
Use the equal
operator.
var count = new Keen.Query("count", {
event_collection: "purchases",
timeframe: "this_14_days",
filters: [
{
property_name: "items",
operator: "eq",
property_value: "pickle"
}
]
});
From the API reference for filters & their operators:
“Equal to” – Note that if your property’s value is an array, “eq” can be used to filter for values inside that array. For example, eq: 5 will match a value of [5, 6, 7].