ShopifyQL is a query language used to generate reports in the Shopify Analytics API. It is structured similarly to SQL. Shopify has an article with more information If you want to learn more about writing ShopifyQL queries.

Below are some simple queries you can run that don’t require any knowledge of SQL. 

Sales By Month

SHOW orders, gross_sales, discounts, returns, net_sales, shipping, taxes, total_sales 
OVER month
FROM sales
SINCE -11m
UNTIL today
ORDER BY month

Sales by Product

SHOW net_quantity, gross_sales, discounts, returns, net_sales, taxes, total_sales 
BY product_vendor, product_type, product_title
FROM sales WHERE sale_line_type == 'product'
SINCE -30d
UNTIL today
ORDER BY gross_sales DESC

Sales by Customer

SHOW orders, gross_sales, net_sales, total_sales 
BY customer_name, customer_email
FROM sales
SINCE -7d
UNTIL today

Customers Over Time

SHOW new_customer_count, orders, order_value 
OVER month
FROM customer_analytics
SINCE -11m 

First Time vs. Returning Customer Sales

SHOW orders, total_sales 
OVER month
BY customer_type
FROM sales 

Sales by Marketing Campaign

SHOW orders, total_sales 
BY utm_campaign_name, marketing_event_type, marketing_event_target
FROM sales WHERE utm_campaign_name != ""
SINCE -30d
UNTIL today
ORDER BY total_sales DESC

Visits Over Time

SHOW total_visitors, total_sessions 
OVER day
FROM visits
SINCE -365d
UNTIL today
ORDER BY day ASC

Visitors by Location

SHOW total_visitors, total_sessions 
BY location_country
FROM visits
SINCE -7d
UNTIL today
ORDER BY total_sessions DESC

Top Online Store Searches

SHOW total_searches 
BY original_query
FROM storefront_searches
SINCE -7d
UNTIL today
ORDER BY total_searches DESC

Top Online Store Searches With No Results

SHOW total_searches 
BY original_query
FROM storefront_searches WHERE returned_results == "No"
SINCE -7d
UNTIL today
ORDER BY total_searches DESC

Questions about ShopifyQL? Email us at support@grow.com or chat in on the site.

Did this answer your question?