You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I get the full response from a funnel query? I would like to print out the with_actors step in addition to the Results, but I don't know how to do that.
Just adding on a bit of context about the Keen IO API. By default that the gem looks at a query "result" which is what you want for 99% of cases.
Example Query Keen.count("purchases") # => 100
For this query the API response was {'result': 100} and keen gem returns simply '100'.
There are a couple instances (e.g. funnels) where a more complex response is returned from the Keen API, like {'result': 100, 'actors':[stuff], 'steps'=[stuff]}
In this instance, keen gem returns simply "100" as well. But there is more stuff in there that we want! How can we interact with the other objects in the response?
Great question! Each query method has a final parameter that is a hash of options for the query. One option you can specify is { :response => :all_keys }. That'll return the API response intact.
How can I get the full response from a funnel query? I would like to print out the with_actors step in addition to the Results, but I don't know how to do that.
From Funnel page for reference:
{
"result":[
200,
20,
180,
100
],
"actors":[
null,
["ef54c5bc3ab0482e393a8dc9d7b5fbc4", "44ba554fd29365868be64e42e5e8fde8", ... ],
null,
null
],
"steps":[
{
"event_collection":"tutorial_completed",
"actor_property":"user.id",
"inverted":false,
"optional":false,
"with_actors":false
},
{
"event_collection":"content_created",
"actor_property":"user.id",
"inverted":true,
"optional":true,
"with_actors":true
},
{
"event_collection":"content_created",
"actor_property":"user.id",
"inverted":false,
"optional":false,
"with_actors":false
},
{
"event_collection":"content_shared",
"actor_property":"user.id",
"inverted":false,
"optional":false,
"with_actors":false
}
]
}
The text was updated successfully, but these errors were encountered: