7.1.2 • Published 10 months ago
vendure-plugin-metrics v7.1.2
Vendure Metrics plugin
A plugin to measure and visualize your shop's average order value (AOV),number of orders per month or per week and number of items per product variant for the past 12 months (or weeks) per variants.
Getting started
- Configure the plugin in
vendure-config.ts
:
import { MetricsPlugin } from "vendure-plugin-metrics";
plugins: [
...
MetricsPlugin,
AdminUiPlugin.init({
port: 3002,
route: 'admin',
app: compileUiExtensions({
outputPath: path.join(__dirname, '__admin-ui'),
extensions: [SalesPerVariantPlugin.ui],
}),
}),
...
]
- Start your Vendure server and login as administrator
- You should now be able to select
metrics
when you click on the buttonadd widget
Metric results are cached in memory to prevent heavy database queries every time a user opens its dashboard.
Metrics
- Average Order Value (AOV): The average of
order.totalWithTax
of the orders per week/month - Nr of items: The number of items sold. When no variants are selected, this metric counts the total nr of items in an order.
- Nr of orders: The number of order per week/month
Breaking changes since 5.x
For simplicity and performance reasons, we decided it makes more sense to display our 3 metrics of choice, and not have metrics extensible with custom Metrics for now. This is what changes in your vendure-config
:
- plugins: [
- MetricsPlugin.init({
- metrics: [
- new NrOfOrdersMetric(),
- new AverageOrderValueMetric(),
- new ConversionRateMetric(),
- new RevenueMetric(),
- ],
- }),
- ]
+ plugins: [
+ MetricsPlugin,
+ ]
You can now also view metrics per variant(s) if you'd like.
Contributions
Thanks @dalyathan for his contributions on this plugin.