Skip to main content
RichRelevance

Category Hints

Category Hints provide additional category context that may allow additional strategies or merchandising rules. Category Hints can be added to any experience type, even to those who do not accept a Category ID.

Setting category hints can be useful on pages that may have an ambiguous category, such as item pages for items that live in multiple categories. If you don’t set the category context, some strategies will derive category information from the Product ID. In this situation, the context can be set to match the user’s breadcrumbs trail.

Category Hints can be added to any page type, and you can pass multiple category hints in the same personalization request. Each category hint qualifies the page for merchandising rules that are associated to the category.

Place your code after your builder's initialization line.

RCHRequestPlacement *placement = [[RCHRequestPlacement alloc] initWithPageType:RCHPlacementPageTypeHome name:@"<placement name>"];
    
RCHPlacementRecsBuilder *builder = [RCHSDK builderForRecsWithPlacement:placement];

// An array of category hints. You can pass one or more category hints.
NSArray *categoryHints = @[
                           @"mens",
                           @"mens-shoes",
                           @"sportswear"];

// Set category hints.
[builder setCategoryHintIDs:categoryHints];

__block RCHRecommendedProduct *product;
[[RCHSDK defaultClient] sendRequest:[builder build] success:^(id responseObject) {
    RCHPlacementsResult *result = responseObject;
    RCHPlacement *placement = result.placements[0];
    product = placement.recommendedProducts[0];
} failure:^(id responseObject, NSError *error){
    // Use this code block to handle any errors that may occur while loading recommendations.
    NSLog(@"Error encountered: %@", error);
}];
  • Was this article helpful?