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​
Option | Type | Description |
---|---|---|
query | string (required) | the query you want results for |
withAttributes | boolean | include product attributes |
callback | (Response) => void (required) | callback to handle the results |
Response​
Typescript Typing
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