Configurable insights about users and purchases.
Dashboard provides information about users activity and purchases based on the date selected by user and configuration options in config. Please find queries explanation in scripts directory.
Depending on user behaviour and configuration options, dashboard highlights three types of users: active, churned and inactive.
User is considered active when he made X
purchases during last Y
days/weeks/months. See query explanation.
X = config.activitySettings.activePurchases
Y = config.activitySettings.activePeriod
User is considered churned on a day when his last purchase was between X
and Y
. See query explanation.
X = SELECTED_DATE - config.activitySettings.churnDelay
Y = SELECTED_DATE - config.activitySettings.churnDelay - config.activitySettings.churnDuration
User is considered inactive when his last purchase was earlier than churning start point X
. See query explanation.
X = SELECTED_DATE - config.activitySettings.churnDelay - config.activitySettings.churnDuration
Dashboard displays number of users who made purchases on selected day, on that’s day week and month, and in period from that day till today.
- Node.js and Express
- MongoDB Native Node.js driver
- ava.js for testing
- React with help of
create-react-app
- SCSS
Frontend part is located in separate repository meetfrank-assignment-frontend.
$ node -v
v10.13.0
$ mongo --version
MongoDB shell version v3.6.3
$ yarn -v
1.12.3
- First, install dependencies:
yarn
. - Make sure your
mongod
is up and running. - Then restore database from dump:
yarn restore
.
yarn start
- Visit http://localhost:3000
yarn test
For simplicity now user selects desired date using <input type="date">
. On iOS Safari, native datepicker lacks support for min
and max
attributes. When user picks date that is out of available data boundaries, it just reverts to first or last available date.
For simplicity, all heavily calculated data is cached and stored in app.locals
. There’re definitely better cache storage choices.
There’s possibility to provide some kind of trend information about user activity, e.g. number of active users dropped by 4%.
Like activity rate or churn rate