Loading...

Last updated: Aug 30 2018

Area: Episerver Perform, Episerver Reach

Search results page tracking request

Note: This information applies to JavaScript API versions 1.3 and 1.4. See Search results page (1.1, 1.2) for previous versions.

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.

NameDescriptionUsage
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. See Migration notes (v1.2 to v1.3).

    term The search term used. [String]
           personalisationAttributesId The unique identifier of the set of personalization attributes generated by the personalization request.

[Optional] [String]

Currently for use with Personalized Find only. Use this ID in tracking requests to identify the set of personalization attributes.

  totalNumberOfResults The number of search results. [Int]
  pageNumber The number of the current page.

[Optional] [Int]

  resultsOnPage The number of search results on the page.

[Optional] [Int]

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 A list of filters on the page. See examples in the code sample below.

[Optional]

An array of elements containing the following parameters.

    filter The attribute name of the filter. [String]
    operator The operation between the filter and the value.

[Optional]

[String]

  • IN  = include
  • EX  = exclude
  • BW  = between for ranges
  • GT  = greater than
  • LT  = less than
    values The attribute values of the filter. List[String]

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 have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/