Personalization is the cornerstone of modern digital experiences — and one of the fastest ways to add personalization is by implementing recommendation widgets.
In Sitecore Search, recommendation recipes offer a ready-made way to suggest relevant content, products, or articles to users based on their behavior or preferences.
In this post, we'll dive into what recommendation recipes are, how to use them effectively, and walk through the technical steps to implement widgets like "Recently Viewed Products by the User" and others. We'll also share some real-world insights, including how long it takes for user interaction data to become available for recommendations.
What Are Recommendation Recipes?
In Sitecore Search, recommendation recipes are pre-built logic templates that you can apply to create personalized content suggestions.
They are essentially rulesets that define which content to recommend, to whom, and under what circumstances.
Common examples include:
- Recently Viewed Products by the User: Resurfaces items the user previously interacted with.
- Recommended for You: Suggests items based on past engagement and/or similarity to viewed products.
- Trending Products: Displays popular items based on overall site activity.
Each recipe can be fine-tuned with filtering, ranking rules, display rules, and event tracking, making them flexible yet powerful building blocks for personalization.
How Recommendation Recipes Work Behind the Scenes
Recommendation recipes depend on two key pillars:
- User Event Tracking
Sitecore Search must track user actions like views, clicks, or purchases. This data is sent to the platform through a collector API or tracking scripts. If you are using the React SDK, then it is easy to implement the ‘trackPageViewEvent’ on every page:
Global events | Sitecore Documentation - Aggregation and Processing
The platform aggregates the event data, applies the selected recipe logic, and returns a tailored list of items when queried through the widget API.
How long does data aggregation take?
Event data in Sitecore Search typically becomes available for recommendations within 15–30 minutes. However, in some cases (especially for low-traffic events or new recipes) it can take up to one hour. It's not instantaneous because the system needs time to process and index behavior data across the audience.
Implementing Recommendation Widgets Using Recipes
1. Prerequisites
Before you start:
- Ensure user event tracking is properly configured on your site (views, clicks, purchases, etc.).
Using the Events API to track events | Sitecore Documentation
You can validate that events are being collected properly by using the Event Monitor in the CEC:
Using the Event Monitor | Sitecore Documentation - Confirm that product content is indexed and available in Sitecore Search.
- Make sure you have API credentials and endpoint URLs for your environment.
API authentication and authorization | Sitecore Documentation
2. Create or Configure a Widget in Sitecore Search
In the Sitecore Search Admin UI:
- Navigate to Widgets → Create Widget (or edit an existing one).
- Choose Widget Type: "Recommendation."
- Select a Recipe such as "Recently Viewed Products by the User."
- Set additional parameters:
- Max number of results.
- Fallback behavior (what happens if no recent views exist).
- Filters (e.g., only recommend products in stock).
- Ranking rules (e.g., prioritize higher-rated products).
3. Make an API Call to Render the Widget
Your front end needs to call the Sitecore Search query API using the widget ID.
Here’s an example request structure if calling the Search endpoint directly:
You'll want to replace the uuid with the value of the current visitor’s uuid, as generated by your chosen SDK.
Using a UUID to track site visitors | Sitecore Documentation
4. Handling the Response
The response will typically return an array of recommended items, including the default set of attributes you have chosen to return in all search API responses:
You can now embed this logic inside your React components, Razor views, or any other frontend framework you use.
Real-World Tips
- Session Persistence: If you want to recommend "recently viewed" products across sessions (not just during a single visit), make sure you use a stable user ID (like a cookie ID or account ID).
- Fallback Content: Always configure a fallback view to avoid empty widgets if no recommendations are available yet.
- Testing: It can take up to an hour for event data to feed into recommendations, so if you're testing newly implemented event tracking, allow a little time before expecting populated results.
- Customization: You can further tweak recipes with custom fields, audience segmentation, or business rules depending on your goals.
Conclusion
Sitecore Search’s recommendation recipes make it fast and efficient to deliver personalized experiences without having to build complex machine learning models from scratch.
By properly tracking user events and setting up recommendation widgets like "Recently Viewed Products," you can create more engaging experiences that encourage users to revisit and purchase products they’ve already expressed interest in.