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

# Search journeys dataset

> LayersQL Search journeys dataset reference for following what shoppers search, view, add to cart, and buy after a starting search.

* **Label:** Search Journeys
* **Description:** The first search in each session that matches an anchor search, followed by the shopper's first distinct follow-up search and the shopping steps after it. Use it to see where shoppers go after a search and whether those journeys end in a purchase. It uses the same destination grouping as the **Follow-up searches** panel in the dashboard.
* **Default group key:** `anchor_term`

## How this dataset differs

* **Filter by one anchor search.** Every query must include `WHERE anchor_term = '...'`. Layers groups the anchor with its query cluster when the term belongs to one cluster.
* **Follow-ups within two hours.** `next_term` is the first distinct search the shopper ran within two hours of the anchor search.
* **First-touch segments.** Marketing, device, location, and customer dimensions use the value recorded at the session's first touch, not at the time of each step. The shared [personalization dimensions](https://docs.uselayers.com/platform/layersql/datasets.md#personalization-dimensions-all-datasets) are not available on this dataset; use the first-touch dimensions listed below instead.
* **History is prepared in the background.** For a store that hasn't used search journeys before, queries return a "still being prepared" message until the history is ready. If you ask for dates older than the prepared history, the message names the earliest available date.

## Metrics

* **sessions (sessions)**
  * Distinct anchor sessions in the group.
  * Example: SHOW sessions
* **anchor\_sessions (sessions)**
  * Anchor sessions before filtering by follow-up search or step.
  * Example: SHOW anchor\_sessions
* **session\_share (%)**
  * Group sessions divided by anchor sessions in the same date and first-touch segment.
  * Example: SHOW session\_share
* **follow\_up\_sessions (sessions)**
  * Sessions taking the grouped `next_term`, `next_cluster_id`, or `follow_up_intent`, regardless of product and step filters.
  * Example: SHOW follow\_up\_sessions
* **follow\_up\_share (%)**
  * Share of anchor sessions taking the grouped follow-up.
  * Example: SHOW follow\_up\_share
* **downstream\_clicks (clicks)**
  * Distinct search-attributed product clicks after the follow-up search, or after the anchor search when there is no follow-up.
  * Example: SHOW downstream\_clicks
* **downstream\_add\_to\_carts (events)**
  * Example: SHOW downstream\_add\_to\_carts
* **downstream\_orders (orders)**
  * Example: SHOW downstream\_orders
* **downstream\_revenue (USD)**
  * Order-line revenue in USD from purchases linked to the follow-up search, or to the original search when there is no follow-up.
  * Example: SHOW downstream\_revenue

## Dimensions

* **anchor\_term**
  * The starting search. Required in `WHERE` with `=`.
* **observed\_anchor\_term**
  * The exact search the shopper typed, before cluster grouping.
* **next\_term**
  * The first distinct follow-up search within two hours.
* **next\_cluster\_id**
  * The follow-up destination grouping used by the **Follow-up searches** panel, including unclustered searches.
* **follow\_up\_intent**
  * How the follow-up relates to the anchor: `same_intent`, `refined`, or `different_intent`. Layers judges this from the products each search served and shoppers clicked, or with AI when traffic is too thin or unclear. Empty when the pair has no label yet.
* **step\_type**
  * `search`, `product_view`, `collection_view`, `add_to_cart`, `purchase`, or `abandon`.
* **step\_number**, **step\_search\_term**, **phase**, **outcome**, **seconds\_to\_next**
  * The step's order in the journey, the most recent search before it, the journey phase, the step outcome, and the seconds until the follow-up search.
* **collection\_handle**, **product\_id**, **position**
  * The collection or product involved in the step, and the product's result position.
* **anchor\_product\_id**
  * The product at the same position in the anchor search's results.
* **audience\_id**
  * A saved audience the session matched at its first touch. A session can match more than one audience.
* **First-touch dimensions:** `marketing_channel`, `marketing_click_source`, `marketing_source`, `marketing_medium`, `marketing_campaign`, `marketing_landing_path`, `device_type`, `session_returning`, `customer_returning`, `geo_country`, `geo_state`, and `b2b`.
* **custom.\<key>**
  * [Custom context dimensions](https://docs.uselayers.com/platform/layersql/datasets.md#custom-context-dimensions), read from the session's first touch.

## Examples

Where shoppers go after searching for "earrings":

```sql theme={null}
FROM search_journeys
SHOW sessions, session_share, downstream_orders
WHERE anchor_term = 'earrings'
GROUP BY next_cluster_id
SINCE -7d
```

How follow-ups split by intent:

```sql theme={null}
FROM search_journeys
SHOW follow_up_share, downstream_revenue
WHERE anchor_term = 'earrings'
GROUP BY follow_up_intent
SINCE -14d
```

Products clicked after a specific refinement, by device:

```sql theme={null}
FROM search_journeys
SHOW downstream_clicks, downstream_orders
WHERE anchor_term = 'earrings' AND next_term = 'pearl earrings'
GROUP BY product_id
SEGMENT BY device_type
SINCE -7d
```

## Next steps

* [LayersQL syntax](https://docs.uselayers.com/platform/layersql/syntax.md)
* [Search (text) dataset](https://docs.uselayers.com/platform/layersql/datasets/search-text.md)
* [Layers MCP server](https://docs.uselayers.com/developers/mcp-servers.md)
