Before you start, why not watch this short video about web recommendations?
When you request recommendations through this API, with the help of the
recommend command, you have to specify:
- The recommendation logic you want to use.
- The number of products to display in widget.
- ID of the DOM element where the recommended products should be rendered. This DOM element needs to exist already when the
recommendcommand is issued.
- the template to use to render the recommended products, either directly or through the ID of the DOM element containing its text. The template should conform to the doT.js template syntax.
In addition, you can specify:
- A baseline of product IDs if you want to compare the performance of the Predict recommendations to an existing recommender.
- A success handler which will be invoked before the recommended products are rendered. This way you can freely modify the set or order of recommended products, or their data. You may even decide not to render the recommended products in certain situations.
- The language in which to render the recommended products (in the case of supported widgets).
recommendis invoked from a test or staging environment, and as a consequence should not be logged on the Predict servers.
recommend, can be used to instruct Predict to recommend only products which:
- are in a specific availability zone,
- meet specific criteria based on product catalog properties (e.g. category),
- do not meet specific criteria based on product catalog properties (e.g. category).
recommend command does not actually send the recommendation request to the Predict servers, for that, you have to issue the
go command. After the Predict server received the requests, it computes the set of recommended products and sends it back to the browser.
If you have specified a
success handler in the
recommend command, it will be invoked, so it will have a chance to modify the data objects corresponding to the recommended products. At the end, the
success handler may or may not invoke the function responsible for rendering the recommended products.
If you have not specified a
success handler, the recommended products are rendered immediately according to the rendering template specified.
You can check whether recommendations are properly requested and rendered by using the Inspector Gadget.
We suggest first familiarizing yourself with the recommender logics we offer, then start working on implementation.