Shopify just opened a new window into advertising performance. The latest developer changelog adds the shop_campaign_insights schema to ShopifyQL, letting apps fetch campaign‑level metrics—like spend, sales, ROAS, and more—directly from the same query endpoint you already use. No new OAuth scopes, no extra integration steps, just a richer data set you can embed in dashboards, reports, or custom automations.
What Changed: shop_campaign_insights in ShopifyQL
The shop_campaign_insights schema is now part of the ShopifyQL ecosystem. It surfaces both campaign‑level and segment‑level metrics, supporting time dimensions from hourly to yearly and respecting the merchant’s shop timezone. In practice, you can query fields such as ad_spend, sales, orders, roas, average_order_value, and average_customer_acquisition_cost by campaign name, customer segment, or any date range you need.
Who Is Affected?
*Developers* building analytics, reporting, or marketing automation apps are the primary audience. If your app already uses the shopifyqlQuery field with the read_reports scope, you can start pulling campaign data immediately. *Merchants* benefit indirectly—any third‑party app that surfaces these insights will give them a clearer picture of ad spend efficiency, helping them allocate budgets smarter.
How to Query Shop Campaigns Data
The query works exactly like any other ShopifyQL request. Below is a minimal GraphQL example that fetches spend, sales, and ROAS for a specific campaign over the last 30 days. Note the use of triple‑quoted strings for readability; you can also build the query dynamically in your language of choice.
graphql
{
shopifyqlQuery(
query: """
SELECT campaign_name, ad_spend, sales, roas
FROM shop_campaign_insights
WHERE campaign_name = 'Summer Sale'
AND date >= '2024-06-01'
"""
) {
rows
}
}
The response returns a rows array where each element corresponds to a time bucket (hourly, daily, etc.) depending on the granularity you requested. From there you can feed the data into charts, CSV exports, or trigger alerts when ROAS dips below a threshold.
Embedding Metrics with Analytics Web Components
If you want to display campaign KPIs without managing a data store, Shopify’s new Analytics Web Components are a shortcut. Drop the <shopify-analytics-metric> tag into your app UI, point it at the shop_campaign_insights schema, and the component renders a live metric card—complete with timezone handling and automatic refresh.
html
<shopify-analytics-metric
schema="shop_campaign_insights"
metric="roas"
filter="campaign_name='Summer Sale'"
period="daily"
></shopify-analytics-metric>
Because the component pulls directly from Shopify’s analytics backend, you don’t need to store or cache the data yourself, reducing compliance overhead and simplifying your architecture.
Next Steps for Developers and Merchants
shopifyqlQuery endpoint version. No code changes are required if you already have a generic query wrapper, but add the new schema name to your whitelist if you enforce schema validation.rows.Merchants should reach out to their app partners and ask whether the app now surfaces Shop Campaigns metrics. If you build the reports yourself, schedule a walkthrough to show how ROAS trends correlate with ad spend changes—this builds trust and demonstrates the value of the new data.
By tapping into shop_campaign_insights today, you future‑proof your analytics stack and give merchants the granular visibility they need to optimize advertising ROI.
Ready to level up your analytics? Start querying the new schema now, embed live metrics with Web Components, and let your merchants make data‑driven campaign decisions faster than ever.

