---
title: Search results page
slug: product-recommendations/docs/search-results-page-1-3-1-4
docTags: 
createdAt: 2026-07-30T20:41:31.037Z
---

:::hint{type="info"}
**Note**
This information applies to **JavaScript API versions 1.3 and 1.4**. See information for [versions 1.1-1.2 here](https://world.optimizely.com/documentation/developer-guides/archive/personalization/integration-guides/javascript-api/json-tracking/tracking-requests/search-results-page/).
:::

You can track the search results page by providing the search term used and the reference codes of the *returned* products. Ensure the reference codes match the codes supplied in the product catalog feed.

| Name          |                             |          | Descriptions and usage                                                                                                                                                                                                                                                                                     |
| ------------- | --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| searchResults |                             |          | **Note:** From version 1.3 of the JavaScript API, the request payload for search tracking has changed in order to track more accurate information.                                                                                                                                                         |
|               | term                        |          | \[String]<br />The search term used.                                                                                                                                                                                                                                                                       |
|               | personalisationAttributesId |          | \[Optional] \[String]<br />The unique identifier of the set of recommendations attributes generated by the recommendations request.<br />Currently for use with Personalized Search & Navigation (formerly Find) only. Use this ID in tracking requests to identify the set of recommendations attributes. |
|               | totalNumberOfResults        |          | \[Int]<br />The number of search results.                                                                                                                                                                                                                                                                  |
|               | pageNumber                  |          | \[Optional] \[Int]<br />The number of the current page.                                                                                                                                                                                                                                                    |
|               | resultsOnPage               |          | \[Optional] \[Int]<br />The number of search results on the page.<br />If not provided, the value defaults to the total number of results.                                                                                                                                                                 |
|               | topResults                  |          | The product codes of the top 3 search results.<br />An array of 3 elements containing a refCode property that indicates the reference codes of the top products returned by the search term.                                                                                                               |
|               |                             | refCode  | The product ID returned in the search results.<br />The refCode provided here must exactly match the refCode (guid) specified in the product catalog feed.<br />**Note**: If you have a custom feed, contact Optimizely to find out which field from the feed is used as a product identifier.             |
|               | filters                     |          | \[Optional]<br />A list of filters on the page. See examples in the code sample below.<br />An array of elements containing the following parameters.                                                                                                                                                      |
|               |                             | filter   | \[String]<br />The attribute name of the filter.                                                                                                                                                                                                                                                           |
|               |                             | operator | \[Optional]<br />The operation between the filter and the value.<br />\[String]<br />- IN  = include<br />- EX  = exclude<br />- BW  = between for ranges<br />- GT  = greater than<br />- LT  = less than                                                                                                 |
|               |                             | values   | List\[String]<br />The attribute values of the filter.                                                                                                                                                                                                                                                     |

### Example: Valid search

```csharp
{
      "type"          : "searchresults",
      "lang"          : "en-gb",
      "searchResults" : {
                          "term"                        : "bags",
                          "personalisationAttributesId" : "abcd1234",
                          "totalNumberOfResults"        : 50,
                          "pageNumber"                  : 1,
                          "resultsOnPage"               : 18,
                          "filters"                     : [{
                                                             "filter"   : "colour",
                                                             "operator" : "IN",
                                                             "values"   : ["red", "orange", "yellow"]
                                                            }, 
                                                            {
                                                              "filter"   : "price",
                                                              "operator" : "BW",
                                                              "values"   : ["0", "50"]
                                                            }, 
                                                            {
                                                              "filter"   : "size",
                                                              "operator" : "IN",
                                                              "values"   : ["XS", "S"]
                                                           }],
                          "topResults"                   : [
                                                             {"refCode" : "RC1"}, 
                                                             {"refCode" : "RC2"}, 
                                                             {"refCode" : "RC3"}
                                                           ]
                        }
    }
```

### Example: 0-search

```csharp
{
      "type"          : "searchresults",
      "lang"          : "en-gb",
      "searchResults" : {
                          "term"                        : "bags",
                          "personalisationAttributesId" : "abcd1234",
                          "totalNumberOfResults"        : 0,
                          "pageNumber"                  : 1,
                          "resultsOnPage"               : 0,
                          "filters"                     : [{
                                                             "filter"   : "colour",
                                                             "operator" : "IN",
                                                             "values"   : ["red", "orange", "yellow"]
                                                            }, 
                                                            {
                                                              "filter"   : "price",
                                                              "operator" : "BW",
                                                              "values"   : ["0", "50"]
                                                            }, 
                                                            {
                                                              "filter" : "size",
                                                              "operator" : "IN",
                                                              "values"   : ["XS", "S"]
                                                           }],
                          "topResults": []
                        }
    }
```

:::hint{type="info"}
**Note**
You can also add the `customAttributes` or `customer` elements to this page tracking request. For more information, see [Add customAttributes or customer elements (Optional)](docId\:x-UWMNCr7HCibp_1X8Mrx).
:::
