Custom SmashGL Cards
~5 min readA Custom SmashGL Card lets you write a SmashGL query directly and display the result as any visualization on your dashboard. Every preset card type in dashboardSMASHBOARD is built on SmashGL — a custom card gives you the same power without the preset defaults.
When to Use a Custom Card
- Metrics not covered by presets — gross profit, specific product categories, cost of goods, or any field Shopify exposes in its analytics API
- Unusual time windows — campaign-specific dates, a fixed launch window, a rolling 45-day period
- Advanced goal configurations — compound goals (revenue AND orders), year-over-year with custom comparison, or goals with custom Alert colors
- Rate metrics — refund rate, conversion rate, or any metric where lower is better or you need percentage display
- Exploration — test a query to see what it returns before committing to a preset card configuration
Adding a Custom Card
- Open a dashboard and click Add Card.
- Select Custom SmashGL from the card type list.
- The Code tab opens with a blank query template.
- Write your SmashGL query.
- Click Save to add the card to your dashboard.
You can also switch any existing card to a custom query by opening its editor and switching to the Code tab.
SmashGL Query Structure
A SmashGL query has three concerns: the GOAL (what success looks like), the SOURCE or DATA (where values come from), and the SMASH (how to display it). Clauses can appear in any order.
GOAL <verb> <metric> [to|by] <value> <time-phrase>
SOURCE shopify.<table>.<column> [AS <alias>] [, ...]
[GROUP BY <dimension>]
[ORDER BY <field> [ASC|DESC]]
[LIMIT <n>]
SMASH <viz> [WITH <flag>, <flag>, ...] [TITLED "<title>"]
A Simple Example
This card shows net revenue for the last 30 days with a goal of 10% growth:
GOAL grow revenue by +10% over last 30 days
SOURCE shopify.sales.net_sales AS revenue, shopify.sales.orders
SMASH metric WITH trend, alert TITLED "Revenue (30d)"
Breaking it down:
GOAL grow revenue by +10% over last 30 days— target is 10% above last period’s net sales, measured over a rolling 30-day windowSOURCE shopify.sales.net_sales AS revenue, shopify.sales.orders—net_salesis the hero number;ordersappears as a secondary statSMASH metric WITH trend, alert TITLED "Revenue (30d)"— display as a Metric card, show the vs-prior pill, pulse the border based on goal status
What You Can Query
SmashGL binds to Shopify data using fully-qualified paths: shopify.<table>.<column>.
shopify.sales — sales data:
| Column | What it is |
|---|---|
shopify.sales.net_sales |
Revenue after discounts, returns, and taxes |
shopify.sales.gross_sales |
Revenue before discounts and returns |
shopify.sales.gross_profit |
Revenue minus cost of goods. Only populated when COGS is configured in Shopify. |
shopify.sales.orders |
Number of orders |
shopify.sales.net_items_sold |
Net quantity of items sold after returns |
shopify.sales.refund_rate |
Refund rate for the period |
shopify.sessions — session data:
| Column | What it is |
|---|---|
shopify.sessions.online_store_visitors |
Unique visitors to the online store |
Derived — AOV:
When shopify.sales.net_sales and shopify.sales.orders are both present in a SOURCE, AOV is automatically computed as net_sales / orders. Reference it as aov in GOAL:
SOURCE shopify.sales.net_sales AS aov, shopify.sales.orders
GOAL grow aov by +3% this month
Common Custom Query Patterns
Gross profit this month:
GOAL hit gp >= $20,000 this month
SOURCE shopify.sales.gross_profit AS gp
SMASH metric WITH alert TITLED "Gross Profit"
Campaign revenue — fixed date range:
GOAL hit revenue >= $25,000 from 2026-11-27 to 2026-11-30
SOURCE shopify.sales.net_sales AS revenue, shopify.sales.orders
SMASH metric WITH alert, forecast, gap TITLED "BFCM Revenue"
Top products this quarter:
WINDOW this quarter
SOURCE shopify.sales.gross_sales AS products
GROUP BY product_title
ORDER BY gross_sales DESC
LIMIT 10
SMASH table TITLED "Top Products (Q)"
Year-over-year revenue:
GOAL grow revenue by +20% over last 30 days
COMPARE previousYear
SOURCE shopify.sales.net_sales AS revenue
SMASH metric WITH trend, alert, forecast TITLED "Revenue YoY"
Refund rate — lower is better, displayed as percentage:
GOAL reduce refund_rate to <= 2% this month
TYPE ratio
FORMAT percent
DIRECTION lower
SOURCE shopify.sales.refund_rate AS refund_rate
SMASH metric WITH trend, alert TITLED "Refund Rate"
Compound goal — revenue AND orders:
GOAL hit revenue >= $15,000 AND hit orders >= 300 this month
SOURCE shopify.sales.net_sales AS revenue,
shopify.sales.orders AS orders
SMASH metric WITH alert, forecast TITLED "Monthly OKR"
Hold an SLA — pass/fail threshold:
GOAL hold uptime >= 99.98% this month
TYPE ratio
SOURCE shopify.sessions.uptime_pct AS uptime
SMASH metric WITH alert TITLED "Uptime SLA"
Soft / aspirational goal:
GOAL grow sessions to >= 50000 this month SOFT
SOURCE shopify.sessions.online_store_visitors AS sessions
SMASH metric WITH alert TITLED "Sessions (Stretch)"
Sparkline with 7-day smoothing:
WINDOW over last 30 days
SMOOTH rolling7
SOURCE shopify.sales.net_sales AS revenue
GROUP BY day
ORDER BY day ASC
SMASH sparkline WITH trend TITLED "Revenue Trend"
Static demo card (no API call):
GOAL hit revenue >= $15,000 this month
DATA revenue = {"net_sales": 47300, "gross_sales": 50600, "orders": 847}
PREVIOUS {"net_sales": 41800, "gross_sales": 44200, "orders": 723}
SMASH metric WITH alert TITLED "Revenue (Demo)"
Full Language Reference
See the SmashGL reference for the complete list of clauses, flags, time window options, goal types, smoothing algorithms, and validation rules.
Next Steps
Still need help?