Run analytics query
run_analytics_queryRun ShopifyQL queries against store analytics to retrieve sales, sessions, and conversion metrics with grouping, filtering, and limits.
Instructions
Runs a ShopifyQL query against the store's analytics, the same data as the reports in the Shopify admin.
A query names a dataset with FROM and what to show with SHOW, and may group, filter, order and limit: FROM sales SHOW total_sales, orders GROUP BY month SINCE -12m ORDER BY month FROM sales SHOW net_sales GROUP BY product_title SINCE -30d ORDER BY net_sales DESC LIMIT 10 FROM sessions SHOW sessions, conversion_rate GROUP BY day SINCE -7d
Reference: https://shopify.dev/docs/api/shopifyql. Needs the read_reports scope. A query that cannot be parsed comes back as an error with Shopify's explanation.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "run_analytics_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The ShopifyQL query. |