Loading...
Area: Optimizely Product Recommendations
Applies to versions: 1.1 -1.2 JavaScript API
Other versions:
ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.

Search results page tracking request

Recommended reading 

Note: This information applies to JavaScript API versions 1.1 and 1.2. See latest version here.

The search results page is tracked by providing the search term used and the reference codes of the products returned.

Note: Ensure the reference codes match the codes supplied in the catalog feed.

Name Description Usage
searchResults    
     

term

The search term used

 

[string]

 

results

A list of product codes

An array of elements containing a refCode property that indicates the reference codes of the products returned by the search term.

A search page is tracked using the following script.

{
  "type"          : "searchresults",
  "lang"          : "en-gb",
  "searchResults" : {
		      "term"    : "hello",
		      "results" : [
			            { "refCode" : "RC1" },
			            { "refCode" : "RC2" }
		                  ]
                    }
} 

A zero search page (that is, one with no results) is tracked using the following script.

{
  "type"          : "searchresults",
  "lang"          : "en-gb",
  "searchResults" : {
		      "term"    : "hello",
		      "results" : []
                    }
} 
Do you find this information helpful? Please log in to provide feedback.

Last updated: Nov 06, 2017

Recommended reading