KPI to be measured
Ask a question
Was this article helpful? 0 out of 0 found this helpful
In this article we are going to illustrate how to create your own personal content recommendation using web services. Before reading this we strongly suggest you to read this article, in order to learn about Predictive Content Recommendation
In order to be able to create your own recommendation, the following conditions must be fulfilled:
- First of all, you will have to make sure that the THRON Intelligence module has been activated.
- Then you will have to make sure that content have been published in the folder where the recommendation is operating, and such content have to be properly tagged with the tags of the TOPIC classification.
- Finally, before invoking any API related to content recommendation you will have to obtain an app's token via loginApp web service. This token has to be related to the specific configuration of Predictive Content Recommendation you intend to use, and has to be included among the headers of the requests in the form: "x-tokenId: <the token here>"
Recommend content via web services
Predictive Content Recommendation exposes two different APIs: one is specific for URL content type, the other one is generic.
The url of the web service to be invoked in order to recommend generic content is a POST request, structured as follows:
- clientId: it is the domain name used to access THRON, usually your company name.
- appId: the ID of the specific recommendation.
In the body of the recommendation request you will have to provide the following JSON:
"contactId": "<the xcontactId of the user here>",
"id": "<the itagId here>"
- contactId: it is the ID of the contact currently visiting the page, and for which you wish to retrieve content to be recommended. This ID can be retrieved using the method exposed by the THRON Tracking Library: _ta.getContactInformation('<yourClientIdHere>');
- Locale: it determines a filter on the content to be recommended. Only content with basic information specified for that language will be recommended.
- tagToBoost: an array of the tags to be used in order to boost specific content in the recommendation. Content with these tags will take precedence.
- recentContent: it can have two different values:
- "KEEP", to allow the recommendation of content that the user has already seen
- "EXCLUDE" to exclude them from the response
- limit: the maximum number of content to be included in the response
- fallback: it can have two values:
- "NONE", to avoid that the PCR proposes a list of content in the selected folders if no tracking has ever been made for that specific content
- "ALL", to have the recommendation retrieve all the content in the selected folders if no tracking has ever been made for that specific content
- contentTypes: an array of content types to be considered for the recommendation. Available values are:
- "IMAGE", "AUDIO", "VIDEO", "OTHER", "PLAYLIST", "PAGELET", "URL"
- detailLevel: a string that specifies the set of values to be returned by the recommendation API. Available values are:
- "MINIMAL", "NAVIGATION", "DELIVERY", "FULL". They correspond to the following schema:
- MINIMAL: only xcontentId
- NAVIGATION:MINIMAL, score, visited, contentType, creationDate, locales, dynThumbService, lastUpdate, owner, metadata, properties
- DELIVERY: NAVIGATION, deliveryInfo, subtitlesUrls
- FULL: DELIVERY, ownerFullname, userId, prettyIds, externalIds, itags, imetadata, linkedCategories, linkedContents, tags, totalDownloadableContents, totalRecommendedContents, contentUGC, commentsCounter, commentsApprovedCounter, lastUpdatedComment, scoreFixedRange, version
The URL of the request to recommend URL content is structured as follows:
The configuration parameters are identical, while the detail of the response changes, depending on the parameters set:
- MINIMAL: id
- NAVIGATION: MINIMAL, score, visited, url, creationDate, locales, dynThumbService, lastUpdate, owner, metadata, properties
- FULL: NAVIGATION, ownerFullname, userId, prettyIds, externalIds, itags, imetadata, linkedCategories, linkedContents, tags, totalDownloadableContents, totalRecommendedContents, commentsCounter, commentsApprovedCounter, lastUpdatedComment, scoreFixedRange, version
If you want a quick way to embed recommended content in your projects, remember that for each single recommendation, THRON provides two embeddable widgets which are ready to use: an Adaptive Content Wall and an Horizontal Content List. Their embed codes can be taken directly into the application's management console. Instructions on how to customize such widgets can be found in this article.