Custom SmashGL Cards

~5 min read

Custom SmashGL Cards

A 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

Adding a Custom Card

  1. Open a dashboard and click Add Card.
  2. Select Custom SmashGL from the card type list.
  3. The Code tab opens with a blank query template.
  4. Write your SmashGL query.
  5. 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_revenue AS revenue, shopify.sales.orders
SMASH   metric WITH trend, alert TITLED "Revenue (30d)"

Breaking it down:

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_revenue 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_revenue AS products
        GROUP BY product_name
        ORDER BY gross_revenue 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_revenue 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_revenue 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.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_revenue 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_revenue": 47300, "gross_revenue": 50600, "orders": 847}
PREVIOUS           {"net_revenue": 41800, "gross_revenue": 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.

Still need help?