Query library
Sample data

ShopifyQL query library

Five major e-commerce analytics examples — open any board to see the query and sample results

01
sales
geography
GROUP BY

Top sales by country

Where revenue actually lands — ranked by total sales.

Spot international concentration, plan markets, and flag FX exposure in one glance.

In plain English: From sales, show total sales by billing country, highest first.

FROM sales
SHOW total_sales, orders, average_order_value, billing_country
GROUP BY billing_country
ORDER BY total_sales DESC
LIMIT 10
VISUALIZE total_sales TYPE bar
02
products
merch
TOP N

Top products by sales

Best sellers ranked by total sales — merch’s daily board.

Prioritize inventory, ads, and homepage slots from real sales, not vanity clicks.

In plain English: From sales, show total sales by product title, top 8.

FROM sales
SHOW total_sales, orders, product_title, product_type
GROUP BY product_title, product_type
ORDER BY total_sales DESC
LIMIT 8
VISUALIZE total_sales TYPE bar
03
sales
TIMESERIES
SINCE

Net sales trend

Daily net sales for the last 30 days — the pulse check.

See whether the business is compounding or cooling before the week closes.

In plain English: From sales, show net sales by day for the last 30 days.

FROM sales
SHOW net_sales
TIMESERIES day
WITH CURRENCY 'USD'
SINCE startOfDay(-30d)
UNTIL today
ORDER BY day ASC
VISUALIZE net_sales TYPE line
04
customers
loyalty
GROUP BY

New vs returning customers

Order mix by first-time vs repeat buyers — loyalty health.

Balance acquisition spend against retention before CAC eats margin.

In plain English: From sales, show orders and total sales by new or returning customer.

FROM sales
SHOW orders, total_sales, average_order_value, new_or_returning_customer
GROUP BY new_or_returning_customer
DURING last_month
ORDER BY orders DESC
WITH TOTALS
05
marketing
channels
AOV

Channel performance

Revenue, orders, and AOV by referring channel.

Put budget where efficiency and volume actually meet.

In plain English: From sales, show total sales and AOV by referring channel.

FROM sales
SHOW total_sales, orders, average_order_value, referring_channel
GROUP BY referring_channel
WHERE referring_channel IS NOT NULL
ORDER BY total_sales DESC
LIMIT 10
VISUALIZE total_sales TYPE bar