Landing Page
Usage
Landing Page Use the following code for a given landing page slug, The callback function will contain the relevant products and filters matching the landing page created:
info
Fast Simon Landing Page creation tool can be found in Dashboard > Landing Page
Example
window.FastSimonSDK.landingPage({
term: "pages/yes-please",
callback: (response) => {
// do stuff
// do more stuff
}
})
Options
Option | Type | Description |
---|---|---|
slug | string (required) | landing page slug identifier |
callback | (Response) => void (required) | callback to handle the results |
page | number (default=1) | use for pagination |
productsPerPage | number | use for custom product count |
sortBy | sortBy (default=relevancy) | callback to handle the results |
narrowBy | Narrow [ ] | use for filtering |
facets | boolean (default=true) | use facets:false if you do not need filters |
withAttributes | boolean (default=true) | use withAttributes:true if you want to include attributes in the product response |
caution
- Make sure that the productsPerPage is the same across all pages
- withAttributes:true might slow serving so only use if you need product tags or attributes
Response
Note: the callback might run twice to optimize speed, there are two scenarios:
- Products and facets were fetched together - callback runs once with be called only once with action "product and facets".
- Products were fetched but facets are still fetching - callback will run twice:
- action "products" will come first and call the callback for the first time
- action "product and facets" will call the callback again once facet fetch is completed
TypeScript Typing
interface Response {
action: "products" | "facets and products"
payload: {
ancestors: CategoryAncestor[]
categoryID: string
products: Product[]
facets?: Facet[]
totalResults: number
sortBy?: SortBy,
narrow?: Narrow[],
isNoResults?: boolean
page?: number
pageCount?: number
bannerHTML?: string
}
}