---
title: shop_campaign_insights
description: >-
  Reference for the ShopifyQL `shop_campaign_insights` table. Every metric and
  dimension, paired with worked example queries.
api_version: 2026-07
source_url:
  html: >-
    https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/shop_campaign_insights
  md: >-
    https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/shop_campaign_insights.md
api_name: shopifyql
---

# shop\_​campaign\_​insights

The `shop_campaign_insights` [schema](https://shopify.dev/docs/api/shopifyql/latest/schemas) captures how your Shop Campaigns perform. It brings campaign sales, ad spend, and customer results together in one table, keyed by campaign.

### Use cases

* **Sales vs. spend**: Group [`shop_campaign_sales`](#shopcampaigninsightsmetric-propertydetail-shopcampaignsales) and [`shop_campaign_ad_spend`](#shopcampaigninsightsmetric-propertydetail-shopcampaignadspend) by [`shop_campaign_name`](#shopcampaigninsightsdimension-propertydetail-shopcampaignname) to see which campaigns return more than they cost.
* **Efficiency**: Show [`shop_campaign_return_on_ad_spend`](#shopcampaigninsightsmetric-propertydetail-shopcampaignreturnonadspend) with [`shop_campaign_average_customer_acquisition_cost`](#shopcampaigninsightsmetric-propertydetail-shopcampaignaveragecustomeracquisitioncost) to see which campaigns bring customers in profitably.
* **Customer trend**: Trend [`shop_campaign_customers`](#shopcampaigninsightsmetric-propertydetail-shopcampaigncustomers) by month to see how many customers campaigns bring in over time.

Examples

### Examples

* ####

  ##### Description

  Rank the top 50 Shop Campaigns this quarter by \`shop\_campaign\_sales\`, with ad spend and ROAS. This example uses \[\`WITH PERCENT\_CHANGE\`]\(/docs/api/shopifyql/latest/syntax/with#percent-change-columns) for the change column, with \[\`COMPARE TO previous\_quarter\`]\(/docs/api/shopifyql/latest/syntax/compare-to) benchmarking each campaign against last quarter.

  ##### ShopifyQL

  ```shopifyql
  FROM shop_campaign_insights
    SHOW shop_campaign_sales, shop_campaign_ad_spend,
      shop_campaign_return_on_ad_spend,
      shop_campaign_average_customer_acquisition_cost
    GROUP BY shop_campaign_name WITH PERCENT_CHANGE
    DURING this_quarter
    COMPARE TO previous_quarter
    ORDER BY shop_campaign_sales DESC
    LIMIT 50
  VISUALIZE shop_campaign_sales TYPE horizontal_bar
  ```

* ####

  ##### Description

  Track weekly \`shop\_campaign\_ad\_spend\` for the five highest-spending Shop Campaigns this quarter. This example uses \[\`GROUP BY TOP 5\`]\(/docs/api/shopifyql/latest/syntax/group-by) to roll the rest into one remainder line.

  ##### ShopifyQL

  ```shopifyql
  FROM shop_campaign_insights
    SHOW shop_campaign_ad_spend, shop_campaign_return_on_ad_spend
    GROUP BY TOP 5 shop_campaign_name WITH GROUP_TOTALS
    TIMESERIES week
    DURING this_quarter
    ORDER BY week ASC
  VISUALIZE shop_campaign_ad_spend TYPE line
  ```

* ####

  ##### Description

  Track weekly \`shop\_campaign\_customers\` from Shop Campaigns across this quarter, with \`shop\_campaign\_average\_order\_value\`. This example uses \[\`WITH TOTALS\`]\(/docs/api/shopifyql/latest/syntax/with#total-columns) to add a quarter-to-date column beside the weekly rows.

  ##### ShopifyQL

  ```shopifyql
  FROM shop_campaign_insights
    SHOW shop_campaign_customers, shop_campaign_average_order_value,
      shop_campaign_insights_last_updated_at
    TIMESERIES week WITH TOTALS
    DURING this_quarter
    ORDER BY week ASC
  VISUALIZE shop_campaign_customers TYPE line
  ```

* ####

  ##### Description

  Compare monthly \`shop\_campaign\_ad\_spend\` this year against last year. This example uses \[\`COMPARE TO previous\_year\`]\(/docs/api/shopifyql/latest/syntax/compare-to) to set last year as the year-over-year baseline.

  ##### ShopifyQL

  ```shopifyql
  FROM shop_campaign_insights
    SHOW shop_campaign_ad_spend
    TIMESERIES month WITH PERCENT_CHANGE
    DURING this_year
    COMPARE TO previous_year
    ORDER BY month ASC
  VISUALIZE shop_campaign_ad_spend TYPE bar
  ```

***

## Metrics

Counts and calculations that let you track key business indicators. Metrics show up as the columns when queried.

Metrics you can use when querying `FROM shop_campaign_insights`.

* **shop\_​campaign\_​ad\_​spend**

  **MONEY**

  The total ad spend tied to orders associated with Shop Campaigns, in your store's currency.

* **shop\_​campaign\_​average\_​customer\_​acquisition\_​cost**

  **MONEY**

  Average customer acquisition cost is reported in your store's currency and is based on customers attributed to Shop Campaigns when their last paid click happened within seven days.

  `Average customer acquisition cost = shop campaign ad spend / shop campaign customers`

* **shop\_​campaign\_​average\_​order\_​value**

  **MONEY**

  The average value of orders associated with Shop Campaigns, in your store's currency.

  `Shop Campaign average order value = shop campaign sales / shop campaign customers`

* **shop\_​campaign\_​customers**

  **INTEGER**

  Number of customers that placed orders associated with Shop Campaigns

* **shop\_​campaign\_​return\_​on\_​ad\_​spend**

  **MULTIPLIER**

  A value of 3 means orders associated with Shop Campaigns produced three times the ad spend in sales.

  `Shop Campaign return on ad spend = shop campaign sales / shop campaign ad spend`

* **shop\_​campaign\_​sales**

  **MONEY**

  Sales revenue from orders associated with Shop Campaigns, after discounts and including taxes and shipping, in your store's currency. Refunds are excluded.

### MONEY

A monetary amount representing currency values such as prices, revenue, costs, and discounts.

```ts
```

### INTEGER

A whole number without decimal places, used for counts, quantities, and other discrete numeric values.

```ts
```

### MULTIPLIER

A numeric multiplier used to scale another value.

```ts
```

***

## Dimensions

Attributes of your data that let you look more granularly at aspects of the data. Group and filter by dimensions to shape the rows your query returns.

Dimensions you can use when querying `FROM shop_campaign_insights`.

* **day**

  **DAY\_TIMESTAMP**

  Use this to group Shop Campaign orders by the day they happened.

* **day\_​of\_​week**

  **DAY\_OF\_WEEK**

  Use this to group Shop Campaign orders by day of week, with values Monday through Sunday.

* **hour**

  **HOUR\_TIMESTAMP**

  Use this to group Shop Campaign orders by the hour they happened.

* **hour\_​of\_​day**

  **HOUR\_OF\_DAY**

  Use this to group Shop Campaign orders by hour of day, with values 0 through 23.

* **month**

  **MONTH\_TIMESTAMP**

  Use this to group Shop Campaign orders by the month they happened.

* **month\_​of\_​year**

  **MONTH\_OF\_YEAR**

  Use this to group Shop Campaign orders by month of year, with values 1 through 12.

* **quarter**

  **QUARTER\_TIMESTAMP**

  Use this to group Shop Campaign orders by the quarter they happened.

* **shop\_​campaign\_​name**

  **STRING**

  Name of the Shop Campaign

* **shop\_​campaign\_​target\_​name**

  **STRING**

  The customer segment targeted by the Shop Campaign. Values include New customers, All other customers, Lapsed - 3 months, and Lapsed - 12 months.

* **shop\_​id**

  **IDENTITY**

  The unique Shopify identifier for your store. Use [`shop_id`](#shopcampaigninsightsdimension-propertydetail-shopid) with [`shop_name`](#shopcampaigninsightsdimension-propertydetail-shopname) to show readable store labels.

* **week**

  **WEEK\_TIMESTAMP**

  Use this to group Shop Campaign orders by the week they happened.

* **week\_​of\_​year**

  **WEEK\_OF\_YEAR**

  Use this to group Shop Campaign orders by week of year, with values 1 through 53.

* **year**

  **YEAR\_TIMESTAMP**

  Use this to group Shop Campaign orders by the year they happened.

* **shop\_​name**

  **STRING**

  Name of your store

### DAY\_TIMESTAMP

A date value truncated to day precision.

```ts
```

### DAY\_OF\_WEEK

A day within a week, used for weekday-based grouping and filtering.

```ts
```

### HOUR\_TIMESTAMP

A timestamp truncated to hour precision.

```ts
```

### HOUR\_OF\_DAY

An hour within a day, typically represented as an integer from 0 to 23.

```ts
```

### MONTH\_TIMESTAMP

A date value representing the start of a month.

```ts
```

### MONTH\_OF\_YEAR

A month number within a year.

```ts
```

### QUARTER\_TIMESTAMP

A date value representing the start of a fiscal quarter.

```ts
```

### STRING

A sequence of characters representing text data.

```ts
```

### IDENTITY

A unique identifier for a Shopify resource such as a customer, product, or order.

```ts
```

### WEEK\_TIMESTAMP

A date value representing the start of a week.

```ts
```

### WEEK\_OF\_YEAR

A week number within a year.

```ts
```

### YEAR\_TIMESTAMP

A date value representing the start of a year.

```ts
```

***

## Related schemas

* [`shop_product_impressions`](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/shop_product_impressions): Switch to this to see which products got exposure from Shop channel impressions.

***
