# Integration Tips

> Source: https://docs.recombee.com/integration_tips

> For the complete documentation index, see [llms.txt](/llms.txt).

**Table of contents**

* [Content Recommendations](#integration-tips-content)  
   * [Videos](#integration-tips-content-videos)  
         * [Items Catalog](#items-catalog)  
                  * [Modeling Series](#modeling-series)  
         * [Interactions](#interactions)  
         * [Scenarios](#scenarios)  
   * [News & Articles](#integration-tips-content-articles)  
         * [Items Catalog](#id2)  
         * [Interactions](#id3)  
         * [Scenarios](#id4)  
   * [Music & Podcasts](#integration-tips-content-music-and-podcasts)  
         * [Items Catalog](#id7)  
         * [Interactions](#id8)  
         * [Setting Up Recommendations](#id9)  
         * [Scenarios](#id10)  
                  * [Songs / Podcasts for You](#songs-podcasts-for-you)  
                  * [New Releases](#new-releases)  
                  * [Trending Songs / Podcasts](#trending-songs-podcasts)  
                  * [Related Songs or Podcasts](#related-songs-or-podcasts)  
                  * [Top Artists / Podcasters for You](#integration-tips-top-artists-for-the-user)  
                  * [Related Artists / Podcasters](#related-artists-podcasters)  
                  * [Top Albums for You](#top-albums-for-you)
* [Product Recommendations](#integration-tips-product)  
   * [Items Catalog](#id11)  
         * [Handling Variants](#handling-variants)  
   * [Interactions](#id12)  
   * [Scenarios](#id14)
* [Real Estate Recommendations](#integration-tips-real-estate)  
   * [Items Catalog](#id17)  
   * [Interactions](#id18)  
   * [Setting Up Recommendations](#id19)  
   * [Scenarios](#id20)  
         * [Properties in User-Specified Area](#properties-in-user-specified-area)  
         * [Properties in a Geolocation](#properties-in-a-geolocation)  
         * [Similar Properties](#similar-properties)  
         * [Homepage for Registered Users](#homepage-for-registered-users)  
         * [Email](#id21)  
         * [Search](#id22)
* [Paginated Recommendations](#paginated-recommendations)

# Integration Tips

Thanks to the versatility of our solution and hundreds of algorithms in our stack Recombee can be utilized in a wide variety of areas. You can use Recombee for recommending almost any type of content or product: videos, articles, fashion, real-estate, podcasts, jobs ... you name it :)

![](/img/headings/integration-tips.png) 

Every domain has its specifics and the following sections present some of the best practices for the correct use of our recommendation service.

---

**Choose your domain**

[Content Recommendationsvideos, news, articles, music, etc.](#integration-tips-content)[Product Recommendationse-commerce, classified advertising, etc.](#integration-tips-product)[Real Estate Recommendationshouses, apartments, land etc. for sale or rent](#integration-tips-real-estate)

---

## Content Recommendations

[Videos](#integration-tips-content-videos)[News & Articles](#integration-tips-content-articles)[Music & Podcasts](#integration-tips-content-music-and-podcasts)

### Videos

![](/img/integration_tips/videos.png) 

#### Items Catalog

* Each video (movie, series, asset) should be an _item_ in Recombee
* Typical [item properties](/getting_started#getting-started-catalog) are for example:  
   * title \[`string`\]  
   * categories/genres \[`set`\]  
   * description \[`string`\]  
   * languages \[`set`\]  
   * image \[`image`\] - for example a poster  
   * cast \[`set`\]  
   * tags \[`set`\]  
   * year \[`int`\]  
   * availability \[`boolean`\]  
   * minimal age of viewer \[`int`\]  
   * available since \[`timestamp`\]  
   * date of expiration \[`timestamp`\]  
   * is subscription needed \[`boolean`\] - for determining if the item is available for a particular user  
   * type \[`string`\] - determines if the item is a _movie_, _series_, _episode_, etc.

##### Modeling Series

Items in the catalog may be organized into [**Series**](/api#series), expressing an explicit, known ordering of items where applicable. Typical examples of series include consecutive TV show episodes, book titles, or podcast episodes.

The hierarchy can be either **one-level** (_series → episodes_) or **multi-level** (_series → seasons → episodes_), depending on the structure of your content.

![](/img/integration_tips/series-schema.png)

* **Step 1: Upload episodes and series as Items**  
Model every **episode**, **season**, and **series** as an _Item_ with the appropriate item properties (e.g., title, director, release date, etc.).
* **Step 2: Set hierarchy**  
Use the [Insert to Series](/api#insert-to-series) endpoint to organize the Items into a series hierarchy.  
   * For a **series → season** link, set [itemType](/api#insert-to-series-param-itemType) \= `series`.  
   * For a **series/season → item** link, set [itemType](/api#insert-to-series-param-itemType) \= `item`.  
   * The [time](/api#insert-to-series-param-time) parameter defines the ordering within the series and should correspond to the season or episode number.  
**Example:**  
   * _For each season_:  
   ```  
   InsertToSeries (seriesId = "<top-level series ID>",  
                   itemType = "series",  
                   itemId = "<season ID>",  
                   time = "<season number>")  
   ```  
   * _For each episode_:  
   ```  
   InsertToSeries (seriesId = "<season ID>",  
                   itemType = "item",  
                   itemId = "<episode ID>",  
                   time = "<episode number within the season>")  
   ```

The [Video Logics](/recommendation_logics#video) have built-in support for handling Series (e.g., recommending newly published episodes, recommending next episode, etc.).

#### Interactions

* Send a [detail view](/api#request-add-detail-view) whenever a user clicks a video thumbnail
* Set a few important milestones in the video (e.g. 15%, 50%, 75%) and send a [view portion](/api#request-set-view-portion) whenever the user watches the video until a milestone
* It is very common to send a [purchase](/api#request-add-purchase) when you consider the movie to be consumed by the user (e.g. the user watched it until 90%)
* If users can bookmark or rate the items, send[bookmarks](/api#request-add-bookmark) and[ratings](/api#request-add-rating)
* Likes should be modeled as positive[ratings](/api#request-add-rating) (e.g. with rating `1.0`)

Don't forget to provide the _recommId_ parameter if the interaction is based on the recommendations. It will[give you very precise insight](/admin_ui#success-metrics-kpi) into the success of the recommendations in the Admin UI.

#### Scenarios

[Video RecipesDiscover how to personalize various use cases within your video platform.](/recipes/video)

### News & Articles

![](/img/integration_tips/news_articles.png) 

#### Items Catalog

* Each article should be an _item_ in Recombee
* Typical[item properties](/getting_started#getting-started-catalog) are for example:  
   * title \[`string`\]  
   * categories \[`set`\]  
   * tags \[`set`\]  
   * published \[`boolean`\]  
   * url \[`string`\]  
   * lead paragraph \[`string`\]  
   * image \[`image`\]  
   * expire date \[`timestamp`\]  
   * is paid content \[`boolean`\]  
   * author \[`string`\]

#### Interactions

* Send a [detail view](/api#request-add-detail-view) whenever a user opens an article.
* If users can rate the items, send[ratings](/api#request-add-rating). Likes should be modeled as positive[ratings](/api#request-add-rating) (e.g. with rating `1.0`).
* Don't forget to provide the _recommId_ parameter if the interaction is based on the recommendations. It will[give you very precise insight](/admin_ui#success-metrics-kpi) into the success of the recommendations in the Admin UI.
* Optional enhancement: Set a few important milestones in the article (e.g. 30%, 50%, 75%) and send a[view portion](/api#request-set-view-portion) whenever the user reads (scrolls) up to the portion

#### Scenarios

[News RecipesDiscover how to personalize various use cases within your news platform.](/recipes/news)

### Music & Podcasts

![](/img/integration_tips/songs.png) 

#### Items Catalog

* Each song should be an _item_ in Recombee
* Typical[item properties](/getting_started#getting-started-catalog) are for example:  
   * title \[`string`\]  
   * artist \[`string`\]  
   * genre \[`string`\]  
   * featured artists \[`set`\]  
   * labels \[`set`\]  
   * album title \[`string`\]  
   * album cover \[`image`\]  
   * country \[`string`\]  
   * release date \[`timestamp`\]  
   * is explicit \[`boolean`\]  
   * duration \[`int`\]

#### Interactions

* Set a few important milestones in the song (e.g. 15%, 50%, 75%, 100%) and send a[view portion](/api#request-set-view-portion) whenever the user listens to the song until a milestone
* Send us [ratings](/api#request-add-rating)with the _rating_ set to `1.0` for liked songs
* Send us [ratings](/api#request-add-rating)with the _rating_ set to `-1.0` for disliked songs

#### Setting Up Recommendations

* Create a [scenario](/scenarios) for each place you want to show the recommendations.
* Set [filters](/reql) to the scenarios: At least a filter for recommending only available items should be set.  
If the availability is based on the release date, the filter can look like this:  
ReQL  
```  
'release_date' < now()  
```  
In many cases, you also need to show only appropriate content to minors. If you set a[user property](/api#user-properties) `is_minor` to _true_ for the minors, then the filter can look like this:  
ReQL  
```  
if context_user["is_minor"] then  
	not 'is_explicit'  
else  
	true  
```

Such filter rules can be added to the[Global Settings](/scenarios#scenarios-in-admin-ui-global-settings), so they are applied to all your scenarios.

#### Scenarios

* Create a [scenario](/scenarios) for each place you want to show the recommendations.

##### Songs / Podcasts for You

To obtain a personalized list of the top songs or podcasts for a user call the[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with the _recombee:personal_ [Logic](/recommendation_logics).

##### New Releases

To obtain a personalized list of the recently added songs or podcasts that shall be interesting for the user, call the[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with the _recombee:personal_ [Logic](/recommendation_logics) and add the_Recent items_ [predefined Filter rule](scenarios#filters).

##### Trending Songs / Podcasts

To obtain songs or podcasts that are currently globally popular, use[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with the _recombee:popular_ [Logic](/recommendation_logics).

* You can choose what time period will be taken into consideration when evaluating the most popular songs using the_timePeriod_ parameter of the Logic (value is in seconds)
* The currently popular content can often vary in different countries. If you upload the user's _country_ as the[user property](/api#user-properties), you can get the content popular among users from the same country by setting _userSegmentFilter_ parameter of the Logic to:  
ReQL  
```  
'country' == context_user["country"]  
```

##### Related Songs or Podcasts

In order to obtain songs that are related to a particular song, call the[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with the _recombee:similar_ [Logic](/recommendation_logics).

You can use these songs e.g. for the autoplay, so it keeps the mood of the song the user is currently listening to.

##### Top Artists / Podcasters for You

Based on the listened songs, Recombee can recommend interesting artists for the user.

* First, create an[Item Segmentation](/segmentations) on the [item property](/getting_started#getting-started-catalog) that contains the primary artist
* Then go to the [Scenarios](/segmentations) section and create a scenario of the[Recommend Item Segments To User](/api#request-recommend-item-segments-to-user) type based on the created _artists_Segmentation

Requesting this scenario will give you the artists that shall be the most interesting for a particular user.

##### Related Artists / Podcasters

You can show the related artists on an artist's detail page.

* If you don't have an[Item Segmentation](/segmentations)based on the primary artist yet, create one
* Then go to the [Scenarios](/segmentations) section and create a scenario of the[Item Segments To Item Segment](/api#request-recommend-item-segments-to-item-segment) with both Context and Result Segmentations set to the_artists_ Segmentation

Requesting this scenario with _segmentId_ set to a particular artist will give you the artists related to that artist.

##### Top Albums for You

Based on the listened songs, Recombee can recommend albums that shall be interesting for the user.

* First, create an[Item Segmentation](/segmentations) on the [item property](/getting_started#getting-started-catalog) that contains the album title or ID
* Then go to the [Scenarios](/segmentations) section and create a scenario of the[Recommend Item Segments To User](/api#request-recommend-item-segments-to-user) type based on the created _albums_Segmentation

Request this scenario to get the top albums for the user.

## Product Recommendations

![](/img/integration_tips/product.png) 

### Items Catalog

* Each product that you want to recommend should be an _item_ in Recombee.
* Typical[item properties](/getting_started#getting-started-catalog) are for example:  
   * title \[`string`\]  
   * image link \[`image`\]  
   * available \[`boolean`\]  
   * categories \[`set`\]  
   * price \[`double`\]  
   * url \[`string`\]  
   * brand / vendor \[`string`\]  
   * on sale \[`boolean`\]

Then there are various segment-specific properties, for example in fashion:

> * gender \[`string`\]
> * material \[`string`\]
> * color \[`string`\]
> * available sizes \[`set`\]

Tip

You can set a [catalog feed](/catalog_feeds) (e.g. Google Merchant Feed) in the Admin UI for products catalog synchronization

#### Handling Variants

* If your products come in multiple variants (sizes, colors), the preferred representation in most cases is to have the master product as an item in Recombee and send interactions to it from pages of all its variants.
* If you want to ensure compatibility of available product sizes and user's preferred sizes, model both as item/user properties and use filter like this one:  
ReQL  
```  
context_user["sizes"] == null OR size('available_sizes' & context_user["sizes"]) > 0  
```
* In the case of having each variant as an item in Recombee, the recommendations will also work, but it may take longer to train the models properly at lower traffic sites as the number of interactions is divided between all the variants.

### Interactions

* Send a [detail view](/api#request-add-detail-view) whenever a user views a detail page of a product
* Send a [cart addition](/api#request-add-cart-addition) whenever a user adds a product into the cart
* Send a [purchase](/api#request-add-purchase) whenever a user buys a product.  
   * There will be an[Add Purchase request](/api#request-add-purchase) per each product in the ordered cart. Optionally, these requests can be sent inside a single[Batch request](/api#request-batch).  
   * Set the `price` parameter to see revenue based on recommendations in the [Admin UI](/admin_ui).
* If users can bookmark or rate the items, send[bookmarks](/api#request-add-bookmark) and[ratings](/api#request-add-rating)
* It is suggested to provide the _recommId_ parameter if the interaction is based on the recommendations.

It will [give you very precise insight](/admin_ui#success-metrics-kpi) into the success of the recommendations in the Admin UI.

### Scenarios

[E-commerce RecipesDiscover how to personalize various use cases within your e-commerce site.](/recipes/e-commerce)

## Real Estate Recommendations

![](/img/integration_tips/real_estate.png) 

### Items Catalog

* Each property (building, apartment, ...) that you want to recommend should be an _item_ in Recombee.
* Typical[item properties](/getting_started#getting-started-catalog) are for example:  
   * title \[`string`\]  
   * image link \[`image`\]  
   * available \[`boolean`\]  
   * url \[`string`\]  
   * state \[`string`\]  
   * city \[`string`\]  
   * neighborhood \[`string`\]  
   * zip code \[`string`\]  
   * latitude \[`double`\]  
   * longitude \[`double`\]  
   * price \[`double`\]  
   * description \[`string`\]  
   * square feet \[`int`\]  
   * number of bedrooms \[`int`\]  
   * number of bathrooms \[`int`\]  
   * parking spaces \[`int`\]  
   * pets allowed \[`boolean`\]  
   * year built \[`int`\]  
   * type \[`string`\] - _apartment_ / _family house_ / _condo_ / ...  
   * amenities \[`set`\] - e.g. _air condition_, _balcony_, _fire place_, _swimming pool_ ...

### Interactions

* Send a [detail view](/api#request-add-detail-view) whenever a user views a detail page of a property
* Send a [bookmark](/api#request-add-bookmark) whenever a user bookmarks a property
* Send a [purchase](/api#request-add-purchase) when a user expresses a strong interest in the particular property - e.g. makes an offer or books a tour.
* Don't forget to provide the _recommId_ parameter if the interaction is based on the recommendations. It will[give you very precise insight](/admin_ui#success-metrics-kpi) into the success of the recommendations in the Admin UI.

### Setting Up Recommendations

* Create a [scenario](/scenarios) for each place you want to show the recommendations.
* Into the [Global Settings](/scenarios#scenarios-in-admin-ui-global-settings) add a filter to allow only available properties to be recommended. You can pick predefined rule _Available items_ from the _Recombee Business Rules Library_.

### Scenarios

#### Properties in User-Specified Area

* After a user inserts the area where the user is looking for a property the best deals for the user in the area will be delivered by Recombee
* Use[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with _recombee:homepage_ [Logic](/recommendation_logics) in that case
* The area inserted by the user should be sent in the `filter`parameter of the[Recommend Items To User request](/api#request-recommend-items-to-user) in order to allow only properties from the particular area. It can look like:  
ReQL  
```  
'state'=="TX" and 'city'=="Austin"  
```
* Alternatively, you can store the user's area to Recombee as[user properties](/api#user-properties), and use filter like:  
ReQL  
```  
'state' == context_user["state"] and 'city' == context_user["city"]  
```

#### Properties in a Geolocation

* If the user browses a map, you can show (or highlight) the most fitting properties for the user (according to the user's past interactions).
* Use[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with _recombee:personal_ [Logic](/recommendation_logics)
* Set the request's `filter` parameter to allow only properties in the map radius. You can use [earth\_distance](/reql_functions#reql-func-earth-distance) ReQL function to achive this.  
ReQL  
```  
earth_distance('latitude', 'longitude', <centre of the map latitude>, < centre of the map longitude> ) < <map radius in metres>  
```

#### Similar Properties

* Use[Recommend Items To Item](/api#request-recommend-items-to-item) with _recombee:similar_ [Logic](/recommendation_logics)
* You may want to apply predefined _Upsell_ rule from the[Recombee Business Rules Library](/scenarios#filters) to prefer items that are a bit more expensive than the one that is currently viewed by the user.

#### Homepage for Registered Users

* Use[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with _recombee:homepage_ [Logic](/recommendation_logics)
* If the user has already interactions, properties in the user's location should be picked by Recombee. You can (especially for new users) ensure it by `filters` or `boosters`.

#### Email

* Use[Recommend Items To User](/api#request-recommend-items-to-user) endpoint with _recombee:emailing_ [Logic](/recommendation_logics)
* If the user has already interactions, properties in the user's location should be picked by Recombee. You can ensure it by setting`filters` or `boosters`.
* If the user set some custom conditions, e.g. minimal number of bedrooms or maximal price, you can also express these as a filter:  
ReQL  
```  
'num_bedrooms' >= 2 and 'price' < 10000  
```

#### Search

* Use the [Search](/api#search) endpoint and let your users search the properties in a personalized way
* You can also apply `filters` or `boosters` \- e.g. search only within an area using[earth\_distance](/reql_functions#reql-func-earth-distance) ReQL function.

## Paginated Recommendations

If you want to get subsequent recommendations for the next page of results, call[Recommend next items](/api#request-recommend-next-items) endpoint.