When requesting recommendations, you can also send us a list of URLs to exclude for that specific query. This option is most useful when you have other recommendation areas not controlled by LiftIgniter (such as a handpicked Editor's List) and want to make sure that LiftIgniter's recommendations do not overlap with the recommendations in those areas. This may require some additional scripting to detect the URLs being used on the page in order to populate the list of items to exclude, but the exact method for doing so will depend on your site.
Generally, you do NOT need to send us a list of URLs to explicitly include. We will automatically leave out:
- the URL the user is currently on
- URLs the user has recently visited in this session
- other items recommended by LiftIgniter for other widgets in the current page (see Implementing Multiple Widgets for more details)
Alternative Blocking Options
We also have a number of other options to block or filter items according to various criteria, and are better able to scale up than blocking a specific list of items.
- For global exclusion, consider hiding the item using noShow.
- For excluding old items, set a max age for recommended items.
- If you want to recommend from a small pool of items, consider using our option to rank a specific set of items.
- For restricting recommendations to within the same category, see our article on filtering by category. To implement category-level or other filters, please contact Support.
Using excludeItems
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 $p("register call"), as shown below.
$p('register', { max: 20, // Large number requested so you can see our full range of items widget: 'default-widget', // name of widget opts: {excludeItems : ["url1", "url2"]}, callback: function(resp) { // You might wish to wrap the code in this callback inside jQuery, to handle load order issues //render the recommendations rendering_callback(resp); // track the recommendation area as the control or 'base' slice. trackAlgo('LI'); } } ); $p('fetch');
The API uses the same field, included in the JSON body of the request.
curl -X POST \ http://query.petametrics.com/v2/model \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "apiKey" : "your-API-key", "url":"http://www.domain.com/current-page", "excludeItems": ["url1", "url2"], "maxCount": 10 }'