How to build commercetools dashboards in Metabase
commercetools is a headless, API-first platform for composable commerce, holding orders, carts, products, and customers across stores and channels. Metabase is where you turn that activity into shared, trustworthy dashboards. This guide covers two complementary paths: a lightweight MCP + CLI route that pulls live data with the commercetools MCP and loads a CSV into Metabase with the Metabase CLI for quick analysis, and a durable pipeline route that syncs commercetools into a database so you can build dashboards anyone can read.
How do you connect commercetools to Metabase?
Most teams combine both routes: use the commercetools MCP and Metabase CLI route to pull live data and stand up a quick analysis, and the pipeline route for the dashboards people depend on.
Live data in, quick analysis out
Pair a commercetools MCP server (to read live carts, orders, and project resources) with the Metabase CLI, whose upload command loads a CSV into Metabase as a ready-to-query table and model.
- Quick lookups like "orders by store this week?"
- Loading a commercetools CSV export into Metabase in seconds
- Spot-checks and one-off analyses without a warehouse
- Great for exploration, not governed reporting
- Use read-only scopes on the commercetools MCP to avoid accidental writes
- CSV uploads are snapshots — refresh or move to the pipeline for history
Durable dashboards with history
Sync commercetools into a database or warehouse with the Export API, GraphQL, or dlt, then point Metabase at it.
- GMV, AOV, and cohort dashboards leaders depend on
- Multi-store, multi-channel composable commerce reporting
- Peak-season comparisons across quarters and years
- You own the refresh schedule and the data model
- Nested JSON (line items, money, custom fields) needs flattening
- Money is stored as centAmount + currencyCode + fractionDigits
What can you analyze from commercetools data in Metabase?
- GMV & sales — gross merchandise value, orders, AOV
- Channels & stores — revenue split across a composable setup
- Catalog performance — top products, variants, and categories
- Customer groups — B2B vs. retail revenue mix
- Orders & payments — order and payment state funnels
- Repeat purchase — cohorts and orders per customer
Which commercetools dashboards should you build in Metabase?
GMV overview
The pulse of a composable storefront.
- Gross merchandise value vs. prior period (number + trend)
- Orders per day (line)
- Average order value (number + trend)
- Revenue by store / channel (bar)
Catalog performance
What's selling across the catalog.
- Top products by net revenue (bar)
- Units sold by variant (table)
- Revenue by category (bar)
- Return rate by product (bar)
Customers & repeat purchase
Are buyers coming back?
- Repeat-purchase rate by cohort (line)
- Orders per customer distribution (bar)
- Revenue by customer group (B2B vs retail) (bar)
- Revenue by acquisition month (cohort table)
Orders & payments
From cart to captured.
- Order state funnel (Open → Confirmed → Complete) (bar)
- Payment state mix (bar)
- Discounts as % of gross (line)
- Cart-to-order conversion (number)
How do you use the commercetools MCP server with the Metabase CLI?
Pair a commercetools MCP server with the Metabase CLI for fast, hands-on analysis. commercetools offers an official Commerce MCP for carts, orders, and project resources, and a Knowledge MCP for docs and API access; the Metabase CLI's upload command loads a CSV into Metabase and creates a ready-to-query table and model. For analysis, grant read-only scopes on the commercetools MCP.
Example workflow
- Ask the commercetools MCP which store or channel drove the most orders this week.
- Export the orders or line items you want to keep as a CSV.
- Run
mb upload csvto load it into Metabase as a table and model, then build questions and dashboards on top.
Be honest about the limits
- The commercetools MCP is great for live lookups — not for scheduled or audited reporting.
- A CSV upload is a point-in-time snapshot; refresh it with
mb upload replaceor move to the pipeline for real history. - Access is scoped by API client credentials — grant read-only scopes so analysis can't trigger writes.
mb upload csvneeds an uploads database configured under Admin → Settings → Uploads.
How do you set up the commercetools MCP server and the Metabase CLI?
commercetools MCPofficial
- Auth
- API client credentials (client ID/secret, scopes)
- Config
- Project key + region auth/API URLs
- Servers
- Commerce MCP (resources) + Knowledge MCP (docs)
- Note
- Grant read-only scopes for analysis.
Metabase CLIofficial
- Install
npm install -g @metabase/cli- Auth
mb auth login(browser OAuth on v62+, or an API key)- Load data
mb upload csv --file data.csv- Requires
- An uploads database (Admin → Settings → Uploads)
{
"mcpServers": {
"commercetools": {
"command": "npx",
"args": ["-y", "@commercetools/mcp-essentials"],
"env": {
"CLIENT_ID": "YOUR_CLIENT_ID",
"CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"PROJECT_KEY": "YOUR_PROJECT_KEY",
"AUTH_URL": "https://auth.<region>.commercetools.com",
"API_URL": "https://api.<region>.commercetools.com"
}
}
}
}# Install the Metabase CLI
npm install -g @metabase/cli
# Log in (opens your browser; requires Metabase v62+)
mb auth login --url https://your-metabase.example.com
# Load a commercetools CSV export — creates a table AND a model
mb upload csv --file commercetools-orders.csv --collection root
# Refresh that same table later from a new export
mb upload replace <table-id> --file commercetools-orders.csvReplace the client credentials, project key, and region URLs with your own; grant read-only scopes for analysis. The Metabase CLI stores its credentials securely after mb auth login and loads each CSV into your uploads database as a table and model.
Can you generate a commercetools dashboard with AI?
Yes. Use the prompt below with any assistant that can run the commercetools MCP server and the Metabase CLI. It works end to end: if commercetools tables already exist in Metabase it analyzes those; otherwise it pulls the data over the commercetools MCP, loads it with mb upload csv, then builds the dashboard — normalizing centAmount money, handling multi-currency, and skipping cards it has no data for.
Create a polished Metabase dashboard for commercetools ecommerce analytics.
Work end to end: get the data into Metabase if it isn't there yet, then build.
Goal: Help commerce leaders understand GMV, average order value, repeat purchase,
catalog performance, and orders/payments from commercetools data.
Step 1 — Find or load the data:
- First, check what already exists in Metabase (search for commercetools tables
and models). If durable commercetools data is already present — synced from a
warehouse or uploaded earlier — use it and skip to Step 2.
- If nothing is there, pull it with a commercetools MCP server in read-only mode:
orders, line items, carts, products (product projections), customers, customer
groups, and categories. Write each result to a CSV, then load it with the
Metabase CLI — run "mb upload csv --file <export>.csv" so each upload creates a
table and a ready-to-query model. Use "mb upload replace <table-id> --file
<export>.csv" to refresh an existing table instead of creating duplicates.
Step 2 — Inspect before querying:
commercetools CSV exports are usually flat (one row per order, line item, or
customer). Warehouse tables are raw and often carry nested JSON (line items,
money, custom fields) that must be flattened. Either way, money is stored as
centAmount with a currencyCode and fractionDigits — normalize it. Inspect the
actual tables and column names first; do not assume exact names. Map what you
find into these analytical concepts where possible: Orders, Line items, Carts,
Products (product projections), Product variants, Customers, Customer groups, and
Categories.
Important:
- Build on whatever data is present; don't claim Metabase connects natively to
commercetools — it reads a database or CLI-uploaded tables.
- Normalize centAmount using fractionDigits and keep currencyCode.
- Report NET revenue and GMV consistently; state the definitions.
- Count only completed/confirmed orders per your definition of paid.
- Use order-level grain for AOV.
- Handle multi-currency: convert to a reporting currency or split by currency.
- Define a "repeat customer" once (2+ paid orders) and reuse it everywhere.
- Only build a card if its underlying column/metric exists in the data.
- A single CSV is a point-in-time snapshot: only build trend cards if there is a
usable date column or multiple periods have been uploaded.
Dashboard title: commercetools Store Overview
Sections:
1. Executive summary (KPI cards): GMV last 30 days; Orders; AOV; Repeat-purchase
rate; Discount depth.
2. Sales & channels: GMV by day; Orders by day; AOV trend; Revenue by store/channel.
3. Catalog performance: Top products by net revenue; Units by variant; Revenue by
category.
4. Customers & retention: Repeat-purchase rate by cohort; Orders per customer;
Revenue by customer group.
5. Orders & payments: Order state funnel; Payment state mix; Discount depth.
Filters: Date range, Store/channel, Category, Customer group, Currency.
Reuse the models Metabase auto-created from uploaded CSVs, or (for a warehouse)
create reusable models: modeled_ct_orders, modeled_ct_line_items,
modeled_ct_products, and modeled_ct_customers.
Output: Build the dashboard if you have permission; otherwise provide the exact
questions, SQL, model definitions, and layout. Include caveats for any metric
that cannot be calculated from the available data. Keep it practical, dense,
and executive-readable. Avoid vanity metrics.How do you sync commercetools data into a database or warehouse?
For dashboards that need history and reliability, land commercetools data in a database first, then connect Metabase to that database.
Connector options
- Export API— commercetools' bulk export for orders, products, and customers into your warehouse.
- dlt(code) — write a Python pipeline against the HTTP or GraphQL API for full control.
- GraphQL / HTTP API (raw) — the source of truth; paginate orders, line items, products, and customers and upsert on a schedule.
- Managed ETL (verify) — check whether your ETL vendor offers a commercetools source; availability varies.
Notes
- Flatten nested JSON (line items, money, custom fields) into clean tables.
- Normalize money from
centAmountusingfractionDigitsand keepcurrencyCode. - Localized names are maps — pick a locale for reporting labels.
How should you model commercetools data in Metabase?
Core tables (after flattening)
| Table | Grain | Key columns |
|---|---|---|
orders | one row per order | id, customer_id, order_state, total_price_cent_amount, currency_code, created_at |
order_line_items | one row per line | order_id, product_id, variant_id, quantity, total_price_cent_amount |
products | one row per product | id, name_en, category_id |
customers | one row per customer | id, email, customer_group_id, created_at |
Modeling advice
- Normalize
order_stateand pick which states count as paid. - Convert cent amounts to a reporting currency, or split by currency.
- Compute AOV at the order grain; define GMV and net revenue once.
- Use
customer_group_idto separate B2B from retail.
Which commercetools metrics should you track in Metabase?
| Metric | Definition | Notes |
|---|---|---|
| GMV | Total order value in a period. | State currency handling. |
| Average order value (AOV) | GMV ÷ orders. | Order grain; segment by store. |
| Repeat-purchase rate | Customers with 2+ paid orders ÷ all. | Fixed window; watch by cohort. |
| Discount depth | Discounts ÷ gross sales. | Ties promotions to margin. |
| Channel mix | Revenue share by store/channel. | Core for composable, multi-store setups. |
What SQL powers commercetools dashboards in Metabase?
These assume flattened tables in a warehouse (PostgreSQL dialect). Money is divided by 100 to illustrate centAmount normalization — adjust to fractionDigits.
Confirmed-order value over the last 30 days.
SELECT
date_trunc('day', o.created_at) AS day,
COUNT(*) AS orders,
SUM(o.total_price_cent_amount) / 100.0 AS gmv
FROM orders o
WHERE o.order_state = 'Confirmed'
AND o.created_at >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY 1
ORDER BY 1;AOV at the order grain, split by currency to stay honest.
SELECT
date_trunc('week', o.created_at) AS week,
o.currency_code AS currency,
COUNT(*) AS orders,
ROUND((SUM(o.total_price_cent_amount) / 100.0) / NULLIF(COUNT(*), 0), 2) AS aov
FROM orders o
WHERE o.order_state = 'Confirmed'
GROUP BY 1, 2
ORDER BY 1;Units and gross revenue by product over 90 days.
SELECT
li.name_en AS product,
SUM(li.quantity) AS units,
SUM(li.total_price_cent_amount) / 100.0 AS gross_revenue
FROM order_line_items li
JOIN orders o ON o.id = li.order_id
WHERE o.order_state = 'Confirmed'
AND o.created_at >= CURRENT_DATE - INTERVAL '90 days'
GROUP BY li.name_en
ORDER BY gross_revenue DESC
LIMIT 20;Share of customers with two or more paid orders.
WITH customer_orders AS (
SELECT customer_id, COUNT(*) AS paid_orders
FROM orders
WHERE order_state = 'Confirmed'
AND customer_id IS NOT NULL
GROUP BY customer_id
)
SELECT
ROUND(100.0 * COUNT(*) FILTER (WHERE paid_orders >= 2)
/ NULLIF(COUNT(*), 0), 2) AS repeat_purchase_rate_pct
FROM customer_orders;