Last active
April 6, 2022 09:04
-
-
Save ttrefren/12564c475632bcbf42a2906497de79d3 to your computer and use it in GitHub Desktop.
Mixpanel JQL query to do frequency analysis (aka the "power curve")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This query will return a frequency analysis, e.g. number of active days in time window. | |
If you ask for 28 days, it will give you the # of users who did your event 1 unique day, 2 unique days, etc | |
in the time window. | |
*/ | |
function main() { | |
return Events({ | |
from_date: '2018-07-01', | |
to_date: '2018-07-28', | |
event_selectors: [{"event": "YOUR EVENT NAME HERE"}] | |
}) | |
.groupByUser([mixpanel.numeric_bucket('time', mixpanel.daily_time_buckets)], mixpanel.reducer.noop()) | |
.groupBy(["key.0"], mixpanel.reducer.count()) | |
.groupBy(["value"], mixpanel.reducer.count()) | |
.map(row => { return { "# active days": row.key[0], "user count": row.value} }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment