Loading...
Loading...
Write, debug, and explain ShopifyQL queries and Shopify Segment Query Language expressions. Use this skill whenever the user wants to query Shopify analytics data, build customer segments, write ShopifyQL for reports, explore sales/orders/products data via the Shopify Admin API, debug a ShopifyQL error, understand available tables/dimensions/metrics, or translate a business question into a Shopify query. Also triggers for: "ShopifyQL", "Shopify analytics query", "customer segment filter", "Shopify segment", "SHOW FROM sales", "GROUP BY in Shopify", "Shopify report query", or any mention of ShopifyQL tables like `sales`, `sessions`, `orders`.
npx skill4agent add devkindhq/shopifyql-skill shopifyqlFROMSHOWFROM <table>
SHOW <metric(s)>
[WHERE <condition>]
[GROUP BY <dimension(s)>]
[SINCE <date> UNTIL <date>] | [DURING <named_range>]
[HAVING <metric_condition>]
[ORDER BY <column> ASC|DESC]
[LIMIT <n>]
[VISUALIZE <column> TYPE <chart_type>]| Table | What it contains |
|---|---|
| Revenue, orders, AOV |
| Traffic, conversion |
| Product performance |
| Customer behaviour (LTV, cohorts) |
| Stock levels |
| Channel attribution |
| Payouts, fees |
FROM ORGANIZATION salessalesSHOWFROM sales
SHOW net_items_sold, gross_sales, discounts, returns, net_sales, taxes, total_sales
WHERE product_title IS NOT NULL
GROUP BY product_title
SINCE -30d UNTIL today
ORDER BY total_sales DESC
LIMIT 100salesgross_salesdiscountsreturnsnet_salestaxestotal_salesnet_items_soldaverage_order_valueorders_countnet_quantitysum()count()avg()max()min()net_salessum(net_sales)FROM sales
SHOW sum(net_sales) AS revenue, count(orders) AS orders
GROUP BY product_title
SINCE -30d UNTIL todayWHEREFROM sales
SHOW net_sales, total_sales
WHERE billing_country = 'US'
AND product_type != 'Gift Card'
GROUP BY product_title
SINCE -30d UNTIL today=!=STARTS WITHENDS WITHCONTAINSANDORNOTSHOWFROM sales
SHOW product_title, net_sales, total_sales
GROUP BY product_title
ORDER BY total_sales DESC
LIMIT 10SINCE -30d UNTIL today
SINCE -1y UNTIL -1dDURING last_month
DURING last_year
DURING this_weekFROM sales
SHOW net_sales, total_sales
TIMESERIES month
SINCE -3m UNTIL todayhourdayweekmonthquarteryearHAVINGGROUP BYFROM sales
SHOW product_title, net_sales, orders_count
GROUP BY product_title
HAVING net_sales > 1000
ORDER BY net_sales DESCFROM sales
SHOW net_sales, total_sales
SINCE -30d UNTIL today
COMPARE TO previous_periodprevious_periodprevious_yearprevious_year_match_day_of_weekWITHFROM sales
SHOW net_sales
TIMESERIES month
WITH PERCENT_CHANGE, CUMULATIVE_VALUESTOTALSGROUP_TOTALSPERCENT_CHANGECUMULATIVE_VALUESCURRENCYTIMEZONEFROM sales
SHOW product_title, net_sales
GROUP BY product_title
ORDER BY net_sales DESC
LIMIT 10
VISUALIZE net_sales TYPE barbarlinedonuthistogramheatmaptablesingle_statFROM customers
SHOW customer_id, net_sales
WHERE products_purchased MATCHES (product_tag = 'sale')
GROUP BY customer_idproducts_purchasedorders_placedshopify_email.EVENT()FROM sales
SHOW sum(net_sales) / count(orders) AS aovSHOW net_sales AS revenue, orders_count AS ordersFROM sales
SHOW top_5(product_title) AS top_products, net_sales AS revenue
GROUP BY top_productsFROMSHOW<attribute> <operator> <value><condition1> AND <condition2> OR <condition3>email_subscription_status = 'SUBSCRIBED' AND (customer_countries CONTAINS 'US' OR amount_spent > 500)Important:,COUNT,SUM,MAXand other aggregate functions are not supported in Segment QL. Use direct attribute comparisons only (e.g.MEDIAN).amount_spent > 500
| Type | Operators |
|---|---|
| Boolean | |
| Date | |
| Enum | |
| Float/Integer | |
| String | |
| List | |
| Function | |
2024-01-012024-01-01T16:00:00-7d-2w-1m-1ytodayyesterdaylast_order_date > -30d
first_order_date BETWEEN 2024-01-01 AND 2024-12-31
last_order_date BETWEEN -365d AND -90d| Attribute | Type | Example |
|---|---|---|
| Enum | |
| Enum | |
| Float | |
| Integer | |
| List<String> | |
| List<Enum> | |
| List<Enum> | |
| List<Enum> | |
| String | |
| String | |
| Enum | |
| Date | |
| Date | |
| Date | |
| Date | |
| Enum | |
| Enum | |
| Enum | |
| Integer | |
| Integer | |
customer_tagscustomer_countriesproducts_purchased MATCHES ()
products_purchased MATCHES (id = 2012162031638)
products_purchased MATCHES (id IN (1012132033639, 2012162031638))
products_purchased MATCHES (id NOT IN (1012132033639))
products_purchased MATCHES (tag = 'sale', date > -90d)
products_purchased MATCHES (id = 1012132033639, date BETWEEN -12m AND today)iddateorders_placed MATCHES (financial_status = 'paid', date > -30d)()shopify_email.opened MATCHES (activity_id = 5240029206, date > -30d)
shopify_email.clicked MATCHES (activity_id IN (5240029206, 1932881090))
shopify_email.bounced NOT MATCHES (activity_id = 5240029206, date BETWEEN -12m AND today)bouncedclickeddeliveredmarked_as_spamopenedunsubscribedanniversary() MATCHES (date = today, attribute = 'birthdate')customer_within_distance() MATCHES (lat = -33.8688, lng = 151.2093, distance = 50, unit = 'km')storefront_event.product_viewed MATCHES (product_id = 1234567890, date > -7d)
storefront_event.collection_viewed MATCHES (collection_id = 987654321)store_credit_accounts MATCHES (balance > 0)FROMsalesGROUP BYSHOWWHEREHAVINGFROM → SHOW → WHERE → GROUP BY → SINCE/UNTIL → HAVING → ORDER BY → LIMITFROM sales
SHOW product_title, product_vendor, product_type,
net_items_sold, gross_sales, discounts, returns, net_sales, taxes, total_sales
WHERE product_title IS NOT NULL
GROUP BY product_title, product_vendor, product_type
DURING last_month
ORDER BY total_sales DESC
LIMIT 20FROM sessions
SHOW referrer_source, sessions_count, converted_sessions
GROUP BY referrer_source
SINCE -30d UNTIL today
ORDER BY converted_sessions DESCFROM sales
SHOW net_sales, total_sales, orders_count
TIMESERIES month
SINCE -3m UNTIL todayamount_spent > 500 AND number_of_orders >= 3 AND last_order_date > -90dlast_order_date BETWEEN -365d AND -90d AND number_of_orders > 1customer_tags CONTAINS 'wholesale' OR amount_spent > 2000FROM → SHOW → WHERE → GROUP BY → SINCE → HAVING → ORDER → LIMITWHEREGROUP BYFROMSHOWANDORsum()net_salessum(net_sales)orders_countcount(orders)parseErrorsreferences/tables.mdshopifyql-executor/shopifyql-setup_mslcp_p75_msinp_p75_ms--rawVISUALIZEWITH TOTALS