Skip to main content

Instant Search

Usage

Use the following code for every keystroke shoppers perform in a searchbox. The callback function will contain the relevant searches, products and categories matching the shopper term:

Example

window.FastSimonSDK.instantSearch({
    query: "shirt",
    callback: (response) => {
        // do stuff
    }
}); 

Options

OptionTypeDescription
querystring (required)the query you want results for
withAttributesbooleaninclude product attributes
callback(Response) => void (required)callback to handle the results

Response

interface Response {
  action: "instantSearch"
  payload: {
    totalResults: number,
    categories?: AutocompleteCategory[],
    products: AutocompleteProduct[]
    turbolinks: AutocompleteTurbolinks[]
    popularSearches: PopularSearch[]
    query: string
    }
}

Reporting Implementation (must for analytics)

Please follow the guideline to report shopper behaviour on the recommendation widget in order to get accurate Analytics in the Fast Simon dashboard as well as greater personalized accuracy

  1. Autocomplete Events