Skip to content

Instantly share code, notes, and snippets.

@wetzler
Last active August 29, 2015 14:16
Show Gist options
  • Save wetzler/29e830f83d3b4caa83f4 to your computer and use it in GitHub Desktop.
Save wetzler/29e830f83d3b4caa83f4 to your computer and use it in GitHub Desktop.
Keen IO OR Funnel Logic
Say you want to know, of all of the users who signed up, how many CREATED a post _OR_ RESPONDED to a post?
There is no built-in "OR" functionality in Keen IO funnels, but there is a way to use a little bit of logic to get the same result.
This imaginary funnel's steps might look like this:
"steps":[
{
"event_collection":"signed_up",
"actor_property":"user.id"
},
{
"event_collection": "created" OR "responded", // This is not real code, it's a sample to illustrate what we're trying to do
"actor_property":"user.id"
}
]
Here is an ACTUAL solution that works!
Solution:
"steps":[
{
"event_collection":"signed_up", // total signups
"actor_property":"user.id"
},
{
"event_collection": "created" // users who did NOT create
"actor_property":"user.id",
"inverted": true
}
{
"event_collection": "responded" // users who did NOT create and did NOT respond
"actor_property":"user.id",
"inverted": true
}
]
result: [100, 80, 70]
result[0] = total users in cohort
result[1] = total users who DID NOT create
result[2] = total users who DID NOT create AND DID NOT respond
users retained = result[2] - result[0] = 30
retention = 30/100 = 30%
This works but it's not super intuitive and requires hacking the JS library a bit to be able to display it correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment