Setting Up the JS API Recommendation Algorithm in Yespo

Receive product recommendations via API and use the resulting list of products to display them in recommendation blocks on your site.

To use the API recommendations:

  1. Install the JavaScript API on your site.
  2. Upload a product data feed to your Yespo account.
  3. Request recommendations from the required pages using the JavaScript API.
  4. After receiving an array of products, set up the display of blocks on your side (appearance, placements, headings).

Connecting API Recommendations

  1. Go to the Site → Recommendations tab and click the New recommendation button.
Recommendations tab underlined in the Site section with the New recommendation button highlighted
  1. Select the Product data for API usage option
Getting recommendation step with the Product data for API usage option highlighted
  1. Each type has different algorithms for product selections, for example, bestsellers for the main page or personalized recommendations for the category page. Any page type is suitable for a wishlist, blog, promotions, etc.
Page type step listing the Main page, Category page, Product page, Cart page, 404 page, and Any page options
  1. Specify data source.
Data source step listing the available algorithms with their IDs
  1. The system will generate a JavaScript function:
  • Copy it to your JavaScript.
  • Call the function when you need to get product recommendations.
  • Use product data in your response at your discretion.
  • Set up ProductImpression event transmission.
API usage instructions with the getRecommendations JavaScript function and the Copy to clipboard button highlighted
📘

Important

In this recommendation type, the ProductImpression event is not automatically sent. Pass it when site visitors actually view the recommendation block. As parameters in the request, you need to pass the product ID and container_type, which were returned in the getRecommendations response.

In the general list of recommendations, API recommendations will be marked with the corresponding icon.

Recommendations list with the API label highlighted next to the recommendation name

Request Limit

Requests for recommendations are rate limited, and the limit applies to each recommendation block separately — reaching it in one block does not affect the others. When the limit is exceeded, the request returns HTTP 429.

If the same block is used in several places at once — for example, in a campaign and on the site through the API — requests from all of them count towards one limit. Contact support to raise the limit for your account.

Examples of JS API requests for different types of site pages >


Did this page help you?