Integrating a recommendation widget
Use the Discover Search and Recommendation API to integrate a recommendation widget with your website.
To integrate a recommendation widget, first, identify the website page on which you want the widget to appear. On the page, create UI components to hold recommendation widget data.
Because a recommendation widget tells users about similar products, common pages for this widget include the home page, the product detail page, and the cart page.
Then, on the Customer Engagement Console (CEC), identify the recommendation search widget and the recipe you want to use. Make sure that you publish the widget before integrating.
Finally, call the Search and Recommendation API to request recommendation widget data and then identify the response parts you want to feed into your website's UI components.
Usually, the content response object contains all the information that you require.
Best Practices
The following are best practices for creating requests to integrate a recommendation widget:
-
To show multiple recommendation widgets on a single page, request all widgets in a single call and check the widget deduplication settings on the CEC. Do this to avoid the same product appearing in different widgets on the same page.
-
To request data for multiple widgets, pass data as a batch object. To request data for a single widget, pass data as a widget object.
-
To show recommendation widgets on a product details page, pass as much page context as possible. At a minimum, send the product SKU and the product URI.
For example, when a user removes an item from the cart page, send a new call with an updated product SKU. This ensures that you show the user updated recommendations that are more relevant to them.