runShopifyQL
Run custom ShopifyQL analytics queries to fetch sales, sessions, and more from your Shopify store. Specify metrics, dimensions, filters, and grouping to generate reports.
Instructions
Run an arbitrary ShopifyQL analytics query against the store. Same data as Admin → Analytics. Canonical clause order: FROM → SHOW → WHERE → SINCE/UNTIL/DURING → GROUP BY → ORDER BY → LIMIT. Dates are BARE (no quotes): SINCE 2026-01-01 UNTIL today or relative SINCE -30d UNTIL today. Use GROUP BY (full keyword), not BY. Dimensions in SHOW must also appear in GROUP BY. Verified datasets: sales (metrics: total_sales, gross_sales, net_sales, orders, average_order_value; dims: product_title, billing_country, customer_type), sessions (metrics: sessions, online_store_visitors, conversion_rate; dims: referrer_source, utm_source, utm_medium, referrer_host). Note: orders and products are NOT valid ShopifyQL datasets — use GraphQL tools instead. Returns { parseErrors: [String], tableData: { columns: [{name,dataType,displayName}], rows: JSON } }. parseErrors is non-empty when the query is syntactically/semantically invalid — read it for the exact field/dataset name issue.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Raw ShopifyQL query string |