Recommendation lists on landing pages¶
A landing page, such as the homepage or a category page, can include a primary list, recommendation list(s), or both. Including recommendation list(s) can be achieved by supplying a page configuration in the request body and sending a POST
-request to the landing-page
endpoint, or by configuring a page in the Experience app and sending a GET
-request to the landing-page
endpoint. For more information, see the Landing page query specification.
Example¶
Below is an example on how to include recommendation lists on a landing page. The example is for a homepage where two recommendation lists are presented: one to present the TOP_PRODUCTS
recommendation and another to present the NEWEST_PRODUCTS
recommendation with products that have prices up to $500. For more information about restricting a product selection in a query, see Product Rules. The id:homepage-1
and id: homepage-2
refers to the sections or recommendation lists identifier for that page in the Experience app.
//request-body.json
{
"recommendationLists": [
{
"id": "homepage-1",
"algorithm": "TOP_PRODUCTS"
},
{
"id": "homepage-2",
"algorithm": "NEWEST_PRODUCTS",
"productRules": "rule incl price [0.00, 500.01]"
}
]
}
#!/bin/bash
curl -X POST \
"https://{cluster-id}.api.esales.apptus.cloud/api/storefront/v3/queries/landing-page?market=US&locale=en-US&customerKey=d9528030-509c-4e0f-b585-7168f1e9feca&sessionKey=customerKey=d9528030-509c-4e0f-b585-7168f1e9feca&touchpoint=DESKTOP&pageReference=/" \
-H 'Content-Type: application/json' \
-d @request-body.json
const api = esales({ clusterId: 'w00000000', market: 'US', locale: 'en-US', touchpoint: 'desktop' });
const results = await api.query.landingPage(
{ pageReference: '/' },
{
recommendationLists: [
{
id: 'homepage-1',
algorithm: 'TOP_PRODUCTS'
},
{
id: 'homepage-2',
algorithm: 'NEWEST_PRODUCTS',
productRules: 'rule incl price [0.00, 500.01]'
}
]
}
);