Recommendations
Prerequisite
Indexing has to be set-up before moving on to Recommendations-related functionalities. For more details, please refer to https://luminoslabs.atlassian.net/wiki/spaces/HC/pages/3717988426
Event tracking is also a prerequisite. Prior to that, an order data export should be done and the resulting files should be uploaded in the Hawksearch Dashboard. This way, the recommendations engine can create meaningful recommendations before any tracking data is gathered from the live website.
Overall Approach
In order to fetch recommendations, the connector provides the Optimizely.Hawksearch.Client package. This package contains classes which will correspond to the requests and responses provided by Hawksearch’s Recommendation API
RecommendationWidgetsRequest → Requesting Product Recommendation Widgets
RecommendationBulkWidgetsRequest → Requesting Multiple Recommendation Widgets
RecommendationResponse
It also provides a client class named RecommendationsClient that will be responsible for calling the mentioned APIs and for deserializing the responses.
For a better experience and easier development, we included in the Optimizely.Hawksearch.Connector package:
Recommendation Widget Block → Optimizely CMS Block with its own client to fasten the development process
The Flow
Using only Optimizely.Hawksearch.Client
Create and populate a RecommendationWidgetsRequest or RecommendationBulkWidgetsRequest object (both derive from BaseRecommendationRequest)
Use the GetWidgetItems or GetBulkWidgetItems method of the RecommendationsClient class (or their async counterparts)
public RecommendationResponse GetWidgetItems(RecommendationWidgetsRequest request) public async Task<RecommendationResponse> GetWidgetItemsAsync(RecommendationWidgetsRequest request) public RecommendationResponse GetBulkWidgetItems(RecommendationBulkWidgetsRequest request) public async Task<RecommendationResponse> GetBulkWidgetItemsAsync(RecommendationBulkWidgetsRequest request)
Get the RecommendationResponse object then map it to your business models
Â
Using both
Optimizely.Hawksearch.Client and Optimizely.Hawksearch.Connector