HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunitySubmit a ticketLog In

Search results page

Describes how to configure a tracking request on the 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 Description and usage

Note: From version 1.3 of the Server-to-Server API, the request payload for search tracking has changed in order to track more accurate information. See Migration notes (v1.2 to v1.3).

  term [String]

The search term used.
  personalisationAttributesId [Optional] [String]

The unique identifier of the set of recommendations attributes generated by the recommendations request.

Currently for use with Personalized Search & Navigation only. Use this ID in tracking requests to identify the set of recommendations attributes.
  totalNumberOfResults [Int]

The number of search results.
  pageNumber [Optional] [Int]

The number of the current page.
  resultsOnPage [Optional] [Int]

The number of search results on the page.

If not provided, the value defaults to the total number of results.
  topResults The product codes of the top 3 search results.

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.

The refCode provided here must exactly match the refCode (guid) specified in the product catalog feed.

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]

A list of filters on the page. See examples in the code sample below

An array of elements containing the following parameters.
    filter [String]

The attribute name of the filter.
    operator [Optional]

The operation between the filter and the value.

  • IN  = include
  • EX  = exclude
  • BW  = between for ranges
  • GT  = greater than
  • LT  = less than
    values List[String]

The attribute values of the filter.

Search results page tracking request example.

      "type"          : "searchresults",
      "ip"            :  "",
      "session"       : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
      "cuid"          : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O",
      "site"          : "retailer",
      "clientToken"   : "1234abcd5678",
      "channel"       : "web",
      "lang"          : "en-gb",
      "currentURI"    : "www.retailer.com/search.html?term=bags",
      "previousURI"   : "www.retailer.com/home.html",
      "userAgent"     : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
      "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"}