Group users into week long cohorts based on the user's signup date. For each cohort, calculate:
- The number of distinct users (orderers) who ordered in the first 7 days after signup. Older cohorts will have more buckets: i.e. 0-7 days, 7-14 days, 14-21 days, etc...
- The number of distinct users who ordered for the first time in each bucket
Please output an html table or CSV that looks something like this. It should include Cohorts, # users, & entries for each bucket.
(this is only an example. this is NOT real data)
Cohort | Users | 0-7 days | 7-14 days | 14-21 days | .... |
---|---|---|---|---|---|
7/1-7/7 | 300 users | 25% orderers (75) 25% 1st time (75) |
|||
6/24-6/30 | 200 users | 15% orderers (30) 15% 1st time (30) |
5% orderers (10) 1.5% 1st time (3) |
||
6/17-6/23 | 100 users | 30% orderers (30) 30% 1st time (30) |
10% orderers (10) 3% 1st time (3) |
15% orderers (15) 5% 1st time (5) |
|
... | ... | ... | ... | ... | ... |
- id
- created_at
- id
- user_id
- created_at
- order_num note: this field is 1-indexed
- Data ends in July '13
- You should default to 8 weeks back worth of cohorts, would be nice if this is customizable (via parameter or form or something)
- All dates are stored in UTC, but occured in PDT. Bonus points for handling that correctly.
- do order numbers count up from 1 for a given user? assuming yes.
- not clear what "weeks back worth of cohorts" - assuming this is columns of order weeks, rather than history back of cohort groups, mainly because it seems like you wouldn't want unlimited columns, though it sounds like you're asking to limit the number of rows?
- I'm leaving cells blank where there are no sales - seems more readable
- install gem
quiply csv/users.csv csv/users.csv
quiply -h
is available, and explains additional configurable options, such as changing the time range or the output format.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome on GitHub at https://github.com/stephancom/quiply. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Quiply project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.