Medusa Stats Overview
May 1, 2026 · 5 min read
medusa-stats is a flexible statistics module for Medusa that features:
- Pluggable statistics providers
- Views, options, and chart composition
- Composite statistics (statistics depending on other statistics)
- Statistics-triggered configurable alerts
- UI interface and admin routes for full statistics lifecycle management
- Caching for optimized performance
#Key Features
#Pluggable Statistics Providers
Statistics providers are the core of the system. The plugin includes two built-in providers:
- Common Provider: General commerce statistics (orders, carts, sales, channels, regions, and aggregates). Read the Common Statistics Provider article for the full metric and parameter reference.
- Composite Provider: Transform statistics that consume other statistics' outputs. Read the Composite Statistics Provider article for dependency-based metrics.
#Views and Options
- Views: Collections of related statistical visualizations organized in any way that suits your needs
- Options: Instances of statistics calculated with specific parameters, fully configurable for visualization and caching
#Composite Statistics
Create advanced analytics by having one statistic option use another option's output as an input. Perfect for calculating moving averages, rates of change, and other derived metrics.
#Alerts System
Configure alerts per option to trigger when conditions are met:
- Absolute and comparative conditions
- Alert logs and scheduled evaluation
- Event emission for custom handling
- Multiple severity levels (info, warning, critical)
#Performance Caching
Optimize performance with configurable caching that stores statistic results for a specified time period, reducing computation overhead.
#Admin Interface
Full-featured admin dashboard for managing statistics, creating views, configuring options, and visualizing data.
#Installation
Install the plugin using npm or yarn:
npm install medusa-stats
# or
yarn add medusa-stats
#Basic Configuration
Add the plugin to your medusa-config.ts:
module.exports = {
modules: [
{
resolve: "medusa-stats/modules/statistics",
dependencies: [ContainerRegistrationKeys.QUERY],
options: {
providers: [
{
resolve: "medusa-stats/providers/common",
},
],
},
},
],
plugins: [`medusa-stats`]
}
#Built-in Statistics
The common provider includes statistics for:
- Order metrics (count, total value, average value)
- Cart metrics
- Sales channel performance
- Regional analytics
Read more in the Common Statistics Provider article.