You can use the Dynamic Yield recommendation engine to return recommendation results without Dynamic Yield rendering them. The results are returned in JSON format, enabling your developers to control how the recommendation is displayed on your site instead of serving it through a recommendation campaign.
Client-side recommendations can also use real-time filters based on data obtained during the current session. For example, you can request products priced higher than the currently viewed product or products that match a visitor's explicit selection.
This article explains how to configure a recommendation strategy for use with the client-side API. For implementation instructions and API details, see Client-side recommendation APIs in the developer documentation.
Recommended implementation
Although you can implement client-side recommendations without a campaign, we recommend calling the API from within a Custom Code campaign variation. This setup enables you to test the implementation, use a control group to measure its impact, and target different recommendation strategies to different audiences without changing your site code.
Create a strategy to call via API
- Go to Assets › Strategies.
- Create or edit a recommendation strategy.
- In the strategy settings, turn on Use via an API call (advanced), and enter the number of items to return. This is usually the number of items you plan to display.
- Save the strategy.
- In the strategies table, open the strategy's More options menu, select Embed code, and copy the API snippet.
- Ask your developer to configure the API and render the returned products.Developers can also register the rendered elements to track recommendation performance.
For implementation instructions, see Client-side recommendation APIs. - Add the code to a Custom Code campaign campaign to run it for the relevant users.
Apply real-time filter rules
Real-time filter rules filter recommendation results using data obtained during the current session. For example, you can request products priced higher than the currently viewed product or products that match a visitor's explicit selection.
Your developer can add these rules through the client-side API. For the supported rules and use cases, see Return Recommendations Real-time Filter Data. For implementation instructions, see Client-side recommendation APIs.
Render recommendations or dynamic content
Render the recommendation defined by a name or ID. This is only applicable for campaigns with Location set to Embed with code: