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

# search Event

> Track when a visitor performs a search

Fires when a visitor performs a search. This helps understand what customers are looking for and can inform product decisions and SEO strategy.

<Note>
  **Shopify:** Automatically tracked when using Shopify's native search functionality.
</Note>

## JavaScript

```javascript theme={null}
window._upstack('track', 'search', {
  searchTerm: 'blue running shoes',
  resultsCount: 24
});
```

With search results:

```javascript theme={null}
window._upstack('track', 'search', {
  searchTerm: 'blue running shoes',
  resultsCount: 24,
  items: [
    { id: 'SKU_001', name: 'Blue Running Shoes', price: 89.99 },
    { id: 'SKU_002', name: 'Navy Training Shoes', price: 79.99 }
  ]
});
```

## Properties

| Property     | Type   | Required | Description                    |
| ------------ | ------ | -------- | ------------------------------ |
| searchTerm   | string | Yes      | The search query entered       |
| resultsCount | number | No       | Number of results returned     |
| items        | array  | No       | Top products in search results |

## When to Fire

* Search results page load
* Predictive search dropdown display
* "No results" page (with `resultsCount: 0`)

## Related Events

* [view\_content](/pixel/events/view-content) — When clicking on a search result
* [view\_item\_list](/pixel/events/view-item-list) — For displaying search results as a list
