---
title: campaign_sessions
description: >-
  Reference for the ShopifyQL `campaign_sessions` 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/campaign_sessions
  md: >-
    https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_sessions.md
api_name: shopifyql
---

# campaign\_​sessions

The `campaign_sessions` [schema](https://shopify.dev/docs/api/shopifyql/latest/schemas) captures what visitors did during online store sessions that came from a marketing campaign. It carries the same engagement and funnel measures as the `sessions` schema, but only for campaign-driven traffic, with campaign, customer, device, browser, and location detail.

### Use cases

* **Session volume**: Group [`campaign_sessions`](#campaignsessionsmetric-propertydetail-campaignsessions) and [`campaign_online_store_visitors`](#campaignsessionsmetric-propertydetail-campaignonlinestorevisitors) by [`campaign_id`](#campaignsessionsdimension-propertydetail-campaignid) to see how much traffic each campaign drove and how many were distinct visitors.
* **Engagement**: Show [`campaign_bounce_rate`](#campaignsessionsmetric-propertydetail-campaignbouncerate) with [`campaign_pageviews_per_session`](#campaignsessionsmetric-propertydetail-campaignpageviewspersession) to judge whether a campaign's traffic engages or bounces.
* **Funnel**: Track [`campaign_sessions_with_cart_additions`](#campaignsessionsmetric-propertydetail-campaignsessionswithcartadditions), [`campaign_sessions_that_reached_checkout`](#campaignsessionsmetric-propertydetail-campaignsessionsthatreachedcheckout), and [`campaign_sessions_that_completed_checkout`](#campaignsessionsmetric-propertydetail-campaignsessionsthatcompletedcheckout) to see where campaign traffic drops out of the purchase funnel.
* **Conversion breakdown**: Break down [`campaign_conversion_rate`](#campaignsessionsmetric-propertydetail-campaignconversionrate) by [`session_device_browser`](#campaignsessionsdimension-propertydetail-sessiondevicebrowser), [`session_device_os`](#campaignsessionsdimension-propertydetail-sessiondeviceos), or [`session_country`](#campaignsessionsdimension-propertydetail-sessioncountry) to see which devices and markets convert campaign traffic best.

Examples

### Examples

* ####

  ##### Description

  Track the full campaign funnel day by day this month, against the prior period. This example uses \[\`WITH PERCENT\_CHANGE\`]\(/docs/api/shopifyql/latest/syntax/with#percent-change-columns) to show which funnel step is slipping.

  ##### ShopifyQL

  ```shopifyql
  FROM campaign_sessions
    SHOW campaign_sessions, campaign_online_store_visitors, campaign_pageviews,
      campaign_sessions_with_cart_additions, campaign_sessions_that_reached_checkout,
      campaign_sessions_that_completed_checkout,
      campaign_sessions_that_reached_and_completed_checkout, campaign_conversion_rate
    TIMESERIES day WITH PERCENT_CHANGE
    DURING this_month
    COMPARE TO previous_period
    ORDER BY day ASC
  VISUALIZE campaign_sessions TYPE line
  ```

* ####

  ##### Description

  Rank the top 10 referring channels over the last 30 days by \`campaign\_checkout\_conversion\_rate\`. This example uses \[\`HAVING\`]\(/docs/api/shopifyql/latest/syntax/having) \`campaign\_sessions > 100\` to drop thin-traffic channels from the ranking.

  ##### ShopifyQL

  ```shopifyql
  FROM campaign_sessions
    SHOW campaign_sessions, campaign_reached_checkout_rate,
      campaign_completed_checkout_rate, campaign_checkout_conversion_rate
    GROUP BY referring_channel WITH TOTALS
    HAVING campaign_sessions > 100
    SINCE startOfDay(-30d) UNTIL today
    ORDER BY campaign_checkout_conversion_rate DESC
    LIMIT 10
  VISUALIZE campaign_checkout_conversion_rate TYPE bar
  ```

* ####

  ##### Description

  Track daily \`campaign\_average\_session\_duration\` across last month, with \`campaign\_pageviews\_per\_session\` and \`campaign\_bounces\`. This example uses \[\`WITH TOTALS\`]\(/docs/api/shopifyql/latest/syntax/with#total-columns) to add a summary column for last month beside the daily rows.

  ##### ShopifyQL

  ```shopifyql
  FROM campaign_sessions
    SHOW campaign_average_session_duration, campaign_pageviews_per_session,
      campaign_bounces
    TIMESERIES day WITH TOTALS
    DURING last_month
    ORDER BY day ASC
  VISUALIZE campaign_average_session_duration TYPE line
  ```

* ####

  ##### Description

  Rank the 10 \`session\_api\_client\` values with the longest \`campaign\_average\_session\_duration\` last month. This example uses \[\`GROUP BY\`]\(/docs/api/shopifyql/latest/syntax/group-by) \`session\_api\_client\` to collapse sessions into one row per client before \`LIMIT 10\` trims the result.

  ##### ShopifyQL

  ```shopifyql
  FROM campaign_sessions
    SHOW campaign_average_session_duration
    GROUP BY session_api_client WITH TOTALS
    DURING last_month
    ORDER BY campaign_average_session_duration DESC
    LIMIT 10
  VISUALIZE campaign_average_session_duration TYPE horizontal_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 campaign_sessions`.

* **campaign\_​added\_​to\_​cart\_​rate**

  **PERCENT**

  The share of online store visits from campaigns where a visitor added at least one item to cart.

  `Campaign added to cart rate = sessions with cart additions / sessions`

* **campaign\_​average\_​session\_​duration**

  **SECOND\_DURATION**

  Average duration, in seconds, of campaign-associated online store visits

* **campaign\_​bounce\_​rate**

  **PERCENT**

  The share of online store visits from campaigns that ended after one pageview.

  `Campaign bounce rate = bounces / sessions`

* **campaign\_​bounces**

  **INTEGER**

  Campaign-associated online store visits that ended after a single pageview

* **campaign\_​checkout\_​conversion\_​rate**

  **PERCENT**

  Among campaign visits that reached checkout, this is the share that completed a purchase.

  `Campaign checkout conversion rate = sessions that completed checkout / sessions that reached checkout`

* **campaign\_​completed\_​checkout\_​rate**

  **PERCENT**

  Among campaign visits where a visitor added an item to cart and reached checkout, this is the share that completed a purchase.

  `Campaign completed checkout rate = sessions with cart additions that reached checkout and completed checkout / sessions with cart additions that reached checkout`

* **campaign\_​conversion\_​rate**

  **PERCENT**

  The share of online store visits from campaigns that ended in a completed checkout.

  `Campaign conversion rate = sessions that completed checkout / sessions`

* **campaign\_​online\_​store\_​visitors**

  **INTEGER**

  Each visitor is counted as a single visitor across their online store visits from campaigns.

* **campaign\_​pageviews**

  **INTEGER**

  A single online store visit from a campaign can contribute more than one pageview.

* **campaign\_​pageviews\_​per\_​session**

  **DECIMAL**

  Average number of pageviews per campaign-associated online store visit

  `Campaign-associated store pageviews per session = pageviews / sessions`

* **campaign\_​reached\_​checkout\_​rate**

  **PERCENT**

  The share of online store visits from campaigns where the visitor reached checkout.

  `Campaign reached checkout rate = sessions that reached checkout / sessions`

* **campaign\_​sessions**

  **INTEGER**

  One visitor can have multiple online store visits from campaigns.

* **campaign\_​sessions\_​that\_​completed\_​checkout**

  **INTEGER**

  Campaign-associated online store visits in which a purchase was completed

* **campaign\_​sessions\_​that\_​reached\_​and\_​completed\_​checkout**

  **INTEGER**

  Campaign-associated online store visits in which the checkout page was reached, then purchase was completed

* **campaign\_​sessions\_​that\_​reached\_​checkout**

  **INTEGER**

  Campaign-associated online store visits in which the checkout page was reached

* **campaign\_​sessions\_​with\_​cart\_​additions**

  **INTEGER**

  Campaign-associated online store visits in which a visitor added an item to cart

### PERCENT

A percentage value represented as a decimal, where 0.25 represents 25%.

```ts
```

### SECOND\_DURATION

A duration measured in seconds.

```ts
```

### INTEGER

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

```ts
```

### DECIMAL

A precise decimal number used for calculations where fixed-point precision matters.

```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 campaign_sessions`.

* **campaign\_​id**

  **IDENTITY**

  Unique identifier for a campaign

* **customer\_​id**

  **IDENTITY**

  The unique Shopify identifier for the customer associated with the online store visit.

* **day**

  **DAY\_TIMESTAMP**

  The day an online store visit from a campaign started.

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

  **DAY\_OF\_WEEK**

  The day of the week an online store visit from a campaign started, with values Monday through Sunday.

* **hour**

  **HOUR\_TIMESTAMP**

  The hour an online store visit from a campaign started.

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

  **HOUR\_OF\_DAY**

  The hour of day an online store visit from a campaign started, with values 0 through 23.

* **landing\_​page\_​path**

  **STRING**

  The path of the first page a campaign visitor landed on when arriving at your online store. Values contain the part of the page address after your store's domain.

* **landing\_​page\_​type**

  **STRING**

  The type of first page a campaign visitor landed on when arriving at your online store, such as a product page, collection page, or the home page.

* **landing\_​page\_​url**

  **STRING**

  The full page address where a campaign visitor first arrived at your online store.

* **minute**

  **MINUTE\_TIMESTAMP**

  The minute an online store visit from a campaign started.

* **month**

  **MONTH\_TIMESTAMP**

  The month an online store visit from a campaign started.

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

  **MONTH\_OF\_YEAR**

  The month of year an online store visit from a campaign started, with values 1 through 12.

* **quarter**

  **QUARTER\_TIMESTAMP**

  The quarter an online store visit from a campaign started.

* **referrer\_​domain**

  **STRING**

  The referring domain, with a leading `www` omitted so visits from `www.example.com` and `example.com` appear under the same domain.

* **referrer\_​name**

  **STRING**

  The referring site name appears as lowercase text.

* **referrer\_​path**

  **STRING**

  The path on the referring site that led to the online store visit. Values contain the part of the referring page address after its domain.

* **referrer\_​site**

  **STRING**

  The referring site domain, including any subdomain, that led to the online store visit. Use [`referrer_site`](#campaignsessionsdimension-propertydetail-referrersite) to distinguish traffic from different parts of the same domain.

* **referrer\_​source**

  **STRING**

  The type of referrer that led to the online store visit, such as Direct, Search, Social, or Email.

* **referrer\_​terms**

  **STRING**

  The search terms from the referring page when they are available. Values are free text, so use [`referrer_terms`](#campaignsessionsdimension-propertydetail-referrerterms) to review the queries that brought visitors to your store.

* **referrer\_​url**

  **STRING**

  External page that led to an online store visit

* **referring\_​channel**

  **STRING**

  Channel that led to an online store visit

* **referring\_​medium**

  **STRING**

  The category of marketing channel that brought the visitor to your online store, such as social, email, or paid search.

* **referring\_​platform**

  **STRING**

  Platform that led to an online store visit

* **second**

  **SECOND\_TIMESTAMP**

  The second an online store visit from a campaign started.

* **session\_​api\_​client**

  **STRING**

  The storefront type used for the online store visit from a campaign, such as Hydrogen, headless, or online store.

* **session\_​bounced**

  **BOOLEAN**

  Whether the online store visit from a campaign ended after one pageview (`true`) or had more than one pageview (`false`).

* **session\_​city**

  **STRING**

  City where the visitor was located when they browsed your online store

* **session\_​country**

  **STRING**

  Country where the visitor was located when they browsed your online store

* **session\_​country\_​code**

  **STRING**

  Country code where the visitor was located when they browsed your online store

* **session\_​device\_​browser**

  **STRING**

  Browser used to visit your online store

* **session\_​device\_​browser\_​version**

  **STRING**

  Version number of the browser used to visit your online store

* **session\_​device\_​os**

  **STRING**

  Operating system of the device used for visiting your online store

* **session\_​device\_​os\_​version**

  **STRING**

  Operating system version of the visitor's device

* **session\_​device\_​type**

  **STRING**

  The kind of device a visitor used during the online store visit from a campaign, such as Desktop, Mobile, Tablet, or Smart TV.

* **session\_​duration**

  **INTEGER**

  Duration, in seconds, of the online store visit

* **session\_​id**

  **STRING**

  Shopify identifier for the online store visit

* **session\_​region**

  **STRING**

  State or province where the visitor was located when they browsed your online store (e.g., California, Ontario)

* **shop\_​id**

  **IDENTITY**

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

* **traffic\_​type**

  **STRING**

  The type of traffic that led to the online store visit from a campaign, such as Direct, Paid, Organic, or Unknown.

* **utm\_​campaign**

  **STRING**

  The campaign name from the UTM tags associated with the online store visit. Values are the text used in your campaign links.

* **utm\_​content**

  **STRING**

  The content value from the UTM tags associated with the online store visit. Values are the text used to distinguish links or creative in your campaign URLs. Use [`utm_content`](#campaignsessionsdimension-propertydetail-utmcontent) to compare specific campaign content.

* **utm\_​medium**

  **STRING**

  The medium value from the UTM tags associated with the online store visit. Values are the text used in your campaign links, such as email, social, or paid search.

* **utm\_​source**

  **STRING**

  The source value from the UTM tags associated with the online store visit. Values are the text used in your campaign links, such as a platform, site, or partner name. Use [`utm_source`](#campaignsessionsdimension-propertydetail-utmsource) to compare where tagged campaign traffic came from.

* **utm\_​term**

  **STRING**

  The term value from the UTM tags associated with the online store visit, often used for keywords or targeting terms. Values are the text used in your campaign links.

* **week**

  **WEEK\_TIMESTAMP**

  The week an online store visit from a campaign started.

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

  **WEEK\_OF\_YEAR**

  The week of year an online store visit from a campaign started, with values 1 through 53.

* **year**

  **YEAR\_TIMESTAMP**

  The year an online store visit from a campaign started.

* **shop\_​name**

  **STRING**

  Name of your store

### IDENTITY

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

```ts
```

### 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
```

### STRING

A sequence of characters representing text data.

```ts
```

### MINUTE\_TIMESTAMP

A timestamp truncated to minute precision.

```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
```

### SECOND\_TIMESTAMP

A timestamp truncated to second precision.

```ts
```

### BOOLEAN

A true or false value representing binary states.

```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

* [`campaign_sales`](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_sales): Downstream order conversion for the same campaign sessions.
* [`campaign_products`](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_products): Product-level attribution from the same campaign sessions.
* [`marketing_engagements`](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/marketing_engagements): App-level engagement, ad spend, and impression data paired with sessions.

***
