Skip to content

Recommendations

Getting recommendations!

It is very easy to get recommendations as you will see bellow:

  • Recommend items to user: The system recommends items to a given user depending on his/her personal taste. This case can be used for example at your homepage. It comes with a few algorithms for you to pick and an auto flag if you can't pick.

  • Recommend items to item: The system recommends items that are somehow related to a given item. The system can take into account also a target user, so this case is useful for example in a detail page of a product or article because the endpoint will give the user a list of related items that he/she might be also interested in.

  • Recommend users to item: The system recommends users that are likely to be interested in a specific item depending on the user's personal taste.

  • Frequently bought together: The system recommends items that were bought together with the requested item. You can use this endpoint to create frequently bought together sections. There this (/v1/recommendations/fbt/items/?ids=1&ids=2... etc) endpoint for multiple fbt items at once call.

  • Categories: The system recommends categories based on where the user has been more active in terms of categories.

  • Most popular items: The system recommends items that were bought frequently in your e-shop. Not suggested for old users as it doesn't offer any personalization.

Besides the recommended items, a unique ID is returned. If the user interacts (views, purchases, etc.) with a recommended item, you shall set this ID to the recommendation_id parameter of that interaction. This will let Advisable.ai know that an recommendation was succesful and also provide you with some metrics later on. This id will also come handy if you wanna ask for more items/user of the same recommendation. In other words recommendations are generated once and the you can access them with that id whenever you want. By default Advisable.ai will return 4 items/users but you can ask for more with the id of the recommendation as described below.

  • Next items/users: This endpoint allows you to ask more items/user from a specific recommendation if you are the id holder. Think of it like a pagination of a recommendation you generated. Also gives you the ability to limit and skip items as you please. For more info check out here.

  • Recommendations count: This endpoint allows you to get a count of all the recommendations that have been generated in a certain period of time when a filter is given otherwise the total count of recommendations of the app is returned. The filters that are in your disposal are

  • _from - _to: provide dates in UNIX timestamp format eg: 1675866414092 OR

  • last_x_days: provide an integer that will reprsesent the number of last days you want to retrieve the count of recommendations for.

The endpoints

The recommendations endpoints follow a similar pattern with the ones we already saw. Let's take a quick look:

  • [GET] /v1/recommendations/users/{user_id}/items
  • [GET] /v1/recommendations/items/{item_id}/items
  • [GET] -/v1/recommendations/items/{item_id}/users
  • [GET] -/v1/recommendations/fbt/items/{item_id}/users
  • [GET] -/v1/recommendations/fbt/items/
  • [GET] -/v1/recommendations/users/{user_id}/categories
  • [GET] -/v1/recommendations/items/most_popular
  • [GET] -/v1/recommendations/{id}/next
  • [GET] -/v1/recommendations/{id}/count

These were the endpoints that are responsible for providing you with recommendations for your users or your items. We use a few algoriths in Advisable.ai, most of them can be found and ran in /v1/recommendations/users/{user_id}/items and the fbt in url path which we plan to remove at some point so keep that in mind.

Algorithms

  • auto: This is the default value if you can't decide what algorithm you should pick. Let the system do it for you but keep in mind this comes with a little bit slower responses on your request
  • cbf: Content based filtering, use it to suggest products from similar categories for the requested user
  • cf: Collaborative filtering, use it to suggest products from similar users to the requested user
  • fbt: Frequently bought together algorithm, use it for Frequently bought together sections
  • mp: Most popular algorithm, use it when there are not enough data for a given user (new users). Lower success rate on old users, could be used in general sections of an e-shop
  • vbf: This is the views based algorithm. It works similarly with the collaborative filtering but it only considers view events instead. Will work fine for new users upon sending at least a few view events.
  • categories: This endpoint will recommend the most suitable categories upon given a user id.

Other parameters

  • with_descriptions (boolean): Defaults to False, use it to add or remove item descriptions from the payloads.
  • limit (int): Defaults to 4, use it to instruct the API on how many results should be returned in that request. Note that if the limit is high enough but the items returned are less then you probably the algorithm have no more items to show.