You can render product recommendations returned in the response in different ways, depending on your website/ecommerce platform. You may implement rendering in one of two ways.
Writing server-side code that injects JSON data to a recommendation template.
By default, all recommendations included in the response are rendered. To render a subset of returned recommendations based on page logic, include the optional `
markRecsAsShown` property (in the smartRecs section) of the request with a value of false. See example below.
After the `
markRecsAsShown` flag is set to **false**, recommendations in the response are _not_ tracked as _viewed_ by the Optimizely service. In other words, although the response includes recommendations, the Optimizely service assumes that they were not rendered on the front end of your site or application.
To provide Optimizely with information about which recommendations are rendered and which are excluded, make an API call from the server or via AJAX from the page.
All parameters in GET requests must be URL-encoded.
For example, a response contains three recommendations with IDs of 32720906612, 32720906613, and 32720906614. Your page or server logic skips the first recommendation but renders the second and third recommendations (that is, IDs 32720906613 and 32720906614). In this case, the Server-to-Server API call looks like the following:
For information about the `
smartRecs` attribute, see [Product Recommendations response](🔗).