Skip to main content
The JavaScript API client wraps POST /v3/recommend/products so you don’t build the request yourself. It ships inside the Depict UI packages.

Install

Import

Add the import at the top of the file where you fetch recommendations:

Fetch recommendations

fetchDepictRecommendations takes an options object and returns a promise of an array of displays (product data). Every option is listed in the reference.
Where to find your merchant and market ids: see Set up DPC.
For a list of possible types, try checking the preview browser or ask your Depict contact. Usually the available types are also detailed in the kickoff slides. If you get a response whose error says the (tenant, market, type) combination is not yet configured, that means a type isn’t available for you - let us know if you want it. (The exact message text uses the v2 vocabulary tenant and may change.)
TypeScript
That’s it for fetching. Render the displays with your own product card, then follow the tracking guide so clicks and purchases are attributed to the recommendations.