Fetching recommendations
The fetchDepictRecommendations
function takes an object of options as its argument, and returns a promise of an array of so-called displays (product data). Reference.
{"error":"(tenant, market, type) not yet configured. Please contact Depict."}
that probably means a type isn’t available for you - let us know if you want it.Fetching general recommendations:
General recommendations are recommendations that aren’t related to any particular content but specific to the type of page. Most often, these are recommendations for the front page.
const frontPageRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
type: "TYPE",
});
Fetching recommendations for one specific product
Use this if you want to fetch recommendations for a specific product. For example, if you want to show recommendations below the description on a product page.
const productPageRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
type: "TYPE",
productId: "this-is-an-amazing-product",
});
Fetching recommendations for multiple products
Use this if you want to fetch recommendations for multiple products, e.g., for everything a user has in their cart.
const cartRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
type: "TYPE",
productIds: ["product-1", "product-2", "product-3"],
});
Fetching recommendations for a specific category
Use this if you want to fetch recommendations for a specific category. Note that this has been deprecated in favour of our category listing product.
const categoryRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
type: "TYPE",
categoryId: "this-is-an-amazing-category",
});
Got more questions? See the reference
Was this page helpful?