# Internal Search Tracking

## Internal Search Tracking

The `search` tracking type is used to capture internal search activity on your website. When a user performs a successful search and is presented with a result page, this command should be pushed to the JENTIS Data Layer.

This tracking helps to:

* Understand user search behavior
* Measure search performance
* Evaluate the quality of search results

### Tracking Commands

* `product` (for each result shown)
* `search`
* `submit`

### Example

```javascript
// Product results (example)
_jts.push({
  track: "product",
  type: "search",
  id: "123",
  name: "Ergonomic Chair"
});

_jts.push({
  track: "product",
  type: "search",
  id: "456",
  name: "Executive Leather Chair"
});

// Search metadata
_jts.push({
  track: "search",
  group: "global site search",
  term: "chair",
  countresults: 144,
  source: "headersearch",
  goal: "productlist"
});

// Submit state
_jts.push({ track: "submit" });
```

### Properties for `search`

| Name           | Description                                                                 | Type   | Mandatory | Example                |
| -------------- | --------------------------------------------------------------------------- | ------ | --------- | ---------------------- |
| `group`        | A meaningful group name for the search context                              | string | no        | `"global site search"` |
| `term`         | The search term input by the user                                           | string | yes       | `"chair"`              |
| `countresults` | Number of results returned by the search                                    | int    | no        | `144`                  |
| `source`       | Where the search was initiated (e.g., header, sidebar, etc.)                | string | no        | `"headersearch"`       |
| `goal`         | The type of content shown on the results page (e.g., productlist, CMS page) | string | no        | `"productlist"`        |

### Product Statement

Every product shown in the search results must be tracked individually using the `track: "product"` command and tagged with `type: "search"`. This ensures they are correctly associated with the `search` context.

#### Example Product

```javascript
_jts.push({
  track: "product",
  type: "search",
  id: "789",
  name: "Mesh Back Task Chair"
});
```

### Summary

* Track each product result with `type: "search"`
* Push one `search` object per search event
* Use `submit` to finalize the state

For product schema details, refer to the [](https://docs.jentis.com/data-capture/web-tracking-setup/set-up-jentis-data-layer/e-commerce-tracking "mention").
