Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I get the full response from a funnel query? #66

Closed
mdumanis opened this issue Feb 4, 2015 · 2 comments
Closed

How can I get the full response from a funnel query? #66

mdumanis opened this issue Feb 4, 2015 · 2 comments
Labels

Comments

@mdumanis
Copy link

mdumanis commented Feb 4, 2015

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
}
]
}

@wetzler
Copy link
Contributor

wetzler commented Feb 4, 2015

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?

@joshed-io
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants