Loading...
Area: Episerver Product Recommendations
Applies to versions: JavaScript 1.3 and higher
Other versions:

Search results page tracking request

Recommended reading 

Note: This information applies to JavaScript API versions 1.3 and 1.4. See information for versions 1.1-1.2 here.

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]

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

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

Currently for use with Personalized Search & Navigation (formerly Find) only. Use this ID in tracking requests to identify the set of personalization 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 Episerver 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.</br ></br > 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.</br ></br > [String]</br >
  • IN  = include
  • EX  = exclude
  • BW  = between for ranges
  • GT  = greater than
  • LT  = less than
    values List[String]

The attribute values of the filter.

Example: Valid search

{
  "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

{
  "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": []
                    }
}
Do you find this information helpful? Please log in to provide feedback.

Last updated: Aug 30, 2018

Recommended reading