> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Products dataset

> LayersQL Products dataset reference covering catalog attributes and performance metrics — views, sales, returns, and velocity — at the product level.

* **Label:** Products
* **Description:** Catalog and performance metrics for products.
* **Default group key:** `product`

## Metrics

* **total\_sales (USD)**
  * Sales after discounts and before taxes/returns.
  * Example: SUM(total\_sales)
* **quantity\_purchased (items)**
  * Number of items purchased.
  * Example: SUM(quantity\_purchased)
* **view\_sessions (sessions)**
  * Sessions where the product was viewed.
  * Example: COUNT\_DISTINCT(view\_sessions)
* **cart\_sessions (sessions)**
  * Sessions where the product was added to cart.
* **quantity\_added\_to\_cart (items)**
  * Items added to cart from online store sessions.
* **product\_impressions (events)**
  * Tracked `product_impression` events captured when a product tile enters the shopper's viewport.
  * Example: SHOW product\_impressions
* **product\_hovers (events)**
  * Tracked `product_hover` events captured when a shopper hovers over a product tile on desktop.
  * Example: SHOW product\_hovers
* **product\_touches (events)**
  * Tracked `product_touch` events captured when a shopper taps or long-presses a product tile on mobile.
  * Example: SHOW product\_touches
* **hover\_rate (rate)**
  * Product hovers divided by product impressions. Useful for measuring tile-level interest on desktop.
  * Example: SHOW hover\_rate
* **touch\_rate (rate)**
  * Product touches divided by product impressions. Useful for measuring tile-level interest on mobile.
  * Example: SHOW touch\_rate

<Note>
  Engagement metrics depend on `product_impression`, `product_hover`, and `product_touch` events. The [Storefront Pixel](/shopify-integration/storefront-pixel) emits these automatically. Custom integrations must send them through the [Tracking API](/tracking-api/send-events).
</Note>

## Dimensions

* **geo\_country:** Two-letter country code.
* **geo\_state:** Up to three-letter province code.
* **geo\_city:** City name as captured.
* **marketing\_source:** UTM source.
* **marketing\_medium:** UTM medium.
* **marketing\_campaign:** UTM campaign.
* **device\_type:** Device category.
* **variant\_id:** Variant ID.

## Product attributes (dynamic)

* **Usage:** Use `product_attributes.*` to group or segment by dynamic product attributes defined in your catalog.
* **Examples:**
  ```sql theme={null}
  GROUP BY product_attributes.color
  GROUP BY product_attributes.size
  SEGMENT BY product_attributes.material
  ```

## Examples

Sales by product (last 7 days)

```sql theme={null}
FROM products
SHOW SUM(total_sales)
GROUP BY product_id
SINCE -7d
```

Views by campaign (this month)

```sql theme={null}
FROM products
SHOW COUNT_DISTINCT(view_sessions)
GROUP BY marketing_campaign
SINCE this_month
```

Sales by color (past 30 days)

```sql theme={null}
FROM products
SHOW SUM(total_sales)
GROUP BY product_attributes.color
SINCE past_30_days
```

Top products by impressions (last 30 days)

```sql theme={null}
FROM products
SHOW product_impressions
GROUP BY product
SINCE -30d
```

Hover rate trend (last 30 days)

```sql theme={null}
FROM products
SHOW hover_rate
SINCE -30d
COMPARE TO previous_period
```

## Next steps

* [LayersQL syntax](/platform/layersql/syntax)
* [LayersQL functions](/platform/layersql/functions)
* [Datasets overview](/platform/layersql/datasets)
