medusa-plugin-stats
is MedusaJS plugin to retreive store statistics data.
-
Run -
yarn add medusa-plugin-stats
ornpm install medusa-plugin-stats
-
Add plugin to your medusa-config.js -
plugins: [
...
`medusa-plugin-stats`
]
- GET
/admin/stats
with following params will return the statictics data
Query params ->
{
entity:[ "sales", "products", "orders", "customers"],
start: "02-24-2022" // start date in MM-dd-yyyy format,
end: "11-24-2022" // end date in MM-dd-yyyy format,
period: "day" // day | week | month | year
}
Response ->
{
"stats": {
"sales": {
"timeseries": {
"10-20-2022": 1000
},
"metrics": {
"total": 1000
},
"period": "day"
},
"products": {
"timeseries": {
"10-22-2022": 7
},
"metrics": {
"total": "7"
},
"period": "day"
},
"orders": {
"timeseries": {
"10-20-2022": 1,
"10-22-2022": 1,
"10-25-2022": 1
},
"metrics": {
"total": "3"
},
"period": "day"
}
}
}
-
[x] Refactor API to allow options to each resource type
-
[x] Add time series stats
-
[ ] Add more stat metrics & dimensions. Required Suggestions
-
[ ] Improve sales stat to allow multiple currencies