Implementing Category pages
Nosto provides functionality to retrieve all products from specific category. This is useful when you want to implement category merchandising using the same search API.
query {
search(
accountId: "YOUR_ACCOUNT_ID"
products: {
categoryId: "123456789"
}
) {
products {
hits {
productId
name
}
total
size
}
}
}
By providing categoryPath parameter API will return all products associated with that category. This parameter is the same as
categories
product field.query {
search(
accountId: "YOUR_ACCOUNT_ID"
products: {
categoryPath: "T-Shirts"
}
) {
products {
hits {
productId
name
}
total
size
}
}
}
In rare cases categoryId or categoryPath is not enough. In these cases custom filters can be used to build any query for category & landing pages.
query {
search(
accountId: "YOUR_ACCOUNT_ID"
products: {
preFilter: [
{
field: "productId",
value: [
"2276",
"2274"
]
}
],
}
) {
products {
hits {
productId
name
}
total
size
}
}
}
Category page results and subsequent filtering, sorting, paginating events should be tracked with JS API library helper where
type = category
. Click events should be tracked accordingly using click helper where type = category
.
Last modified 12d ago