Exclude items from recommendations

Note that this documentation covers the case when you want to exclude items from recommendations on a per-query level. If there are some items you want to globally exclude from recommendations (i.e., you never want us to recommend them) you should set the noShow attribute for those items, as discussed in Editing Fields/Hiding Item.

If, on a given impression, you want to exclude specific items from the recommendations we return, you can specify the list of items in a field name called excludeItems in the opts of the register call, as shown below.

Note that in most contexts, we already exclude most of the items the user has recently browsed, so you do not need to explicitly send the browsing history. This option is most useful when you are doing paginated recommendations, or if you have other areas not controlled by LiftIgniter and want to make sure that LiftIgniter's recommendations do not overlap with the recommendations in those areas.

$p('register', {
                  max: 100, // Large number requested so you can see our full range of items
                  opts: {excludeItems : ["url1", "url2"]},
                  widget: 'default-widget', // name of widget
                  callback: function(resp) {
                    console.log(JSON.stringify(resp, null, 2));
                    console.log("// TEST.");

Illustration of how adding excludeItems changes the set of recommendations to ones that exclude the list sent.

Alternative approaches

Other alternatives to this approach you can consider:

Corresponding option for model query API endpoint

If using the model query API endpoint, you can include an array of strings with the name excludeItems in the JSON body of the query. For more details, see the model query API endpoint documentation.