Getting personalized recommendations to show a returning visitor by specifying a recipe
In Sitecore Search, if you pass context that will uniquely identify a visitor, like a user_id or uuid, and use a recipe that works with visitor context, you can get recommendations specific to what the visitor has been looking at.
To get personalized recommendations, you'll need to use a visitor-based recipe that works using information about visitors. The other type of recipe, item-based recipes, work using input such as the content item on the page or a category of content items.
Depending on the scenario and the Sitecore Search setup, to get personalized recommendations you can do either of the following:
-
If an administrator has set up a visitor-based recipe for the entity you want to pass, you can pass an empty
recommendations.contentobject. When you do this, you'll get recommendations based on the Search setting for this entity. -
If an administrator has set up an item-based recipe for the entity you want to pass, you can override this by specifying a visitor-based recipe in your request.
For recipes that rely on visitor data or content performance metrics, you must integrate event tracking and check that it is working correctly.
For example, you know the visitor's uuid and locale. You want to get recommendations for the content entity based on the Personalized New Arrival Products recipe. In Search, however, the administrator has configured a different recipe for the content entity. To handle this, in your request, pass the ID and version of the Personalized New Arrival Products recipe. This ensures that the response contains recommendations from the Personalized New Arrival Products recipe, and not the recipe in Search.
Here's a sample request:
{
"context": {
"locale": "en-us",
"page": {
"uri": "/sample-page"
},
"user": {
"uuid": "123e4567-e89b-12d3-a456-426614174000"
}
},
"source": "12345",
"widget": {
"items": [
{
"entity": "content",
"rfk_id": "rfkid_1",
"recommendations": {
"content": {},
"limit": 5,
"recipe": {
"id": "recipe_123",
"version": 1
}
}
}
]
}
}
To retrieve the recipe ID, on the menu bar, click Global Resources > Recipes, then select a recipe. Copy the RECIPE ID from the left pane.