Time Estimate

# Set Up Predictive Sort

## Learning Objectives

After completing this unit, you’ll be able to:
• Describe three ways you can use sorting rules.
• List three ways you can sort search results.
• List three types of search in which Predictive Sort is embedded.
• List the data sources that Predictive Sort uses to calculate the affinity of an individual shopper.
• Explain three ways to troubleshoot problems with Predictive Sort.

## Introduction

Brandon Wilson, Cloud Kicks’s merchandiser, already uses sorting rules in his storefront to control what shows up first in search results. He’s all about helping his shoppers find the products they’re looking for. With Einstein Predictive Sort, he can go beyond manual sorting configurations and calculations with personalized results based on predictive intelligence.

Before exploring what Predictive Sort offers and how he can use it, he first takes a look at how he uses sorting rules today.

## Sorting Rules

Brandon configures sorting rules for:

• Keyword search term results
• Searches refined by a category
• Dynamic attributes that have a specified weighting
• Default values for stale or undefined data
• Keyword groups based on customer search terms
• A dropdown for shoppers to select a sort order for search results

B2C Commerce uses sorting rules to determine the sort order of search results. These rules are based on attributes, such as text relevance or availability, or an explicit placement such as featured products or accessories. Brandon assigns one or more attributes to a sorting rule and defines blended attributes where each attribute in a blend has an assigned weight.

B2C Commerce evaluates all products by the value of the first attribute. If products have the same value for the first attribute, it uses the values in the second attribute to break the tie, and then the values of the third attribute, and so on. After B2C Commerce evaluates all the rules, it uses the default sorting rules to sort any products that are still tied. The default sorting rules are based on the order of products in the search index. This index can change each time you build it in Business Manager.

Here are the ways you can sort and our best practice for their processing order.

Order
Sort Method
Description
1
Explicit category placement
You can assign a position to a product within category search results.
2
Explicit product placement
You can assign the search placement attribute of 1–8 to any product.
3
Explicit search rank low, medium, or high
You can assign the search rank attribute to low, medium, or high for any product.
4
Availability ranking
You can let the availability of an item influence its position in the search results, so that out-of-stock items appear at the end of the search results.
5
Text relevance
You can boost the importance of certain attributes, so that if a search term is found in that attribute it's treated as more significant than other fields.
6
Term frequency
If you remove all and don’t configure any sorting rules, B2C Commerce returns results based on the frequency of the term in the search index.

Brandon creates his sorting rules this way:

• Explicitly set the search rank for some products to three (high), two (medium), or one (low).
• Use other ranking techniques, such as availability, to sort items within the search rank.
• Boost attributes that are more significant if they contain the search term. For example, if a shopper searches on women’s shoes, B2C Commerce returns results from the Women’s category first. It includes products in other categories with the word "shoes" in the title or description at the end of the search results. Products in other categories with the word shoes in the title or description are included at the end of the search results.
• Use a dynamic attribute that blends Days Available and Sales Velocity to push new and best selling products to the top.

## Hierarchy Inheritance

Search rank and search placement attribute values for a product are automatically inherited in a hierarchical structure. A category defines the search rank or placement for the products assigned to it and its subcategories. This makes it easy for Brandon to organize general results placement within the catalog structure. To meet business requirements, he can change individual subcategory and product values, which then override the search rank or placement value inherited from the parent.

## Predictive Sort

Brandon takes a look at how he can improve his shoppers’ experience via Einstein Predictive Sort, which is embedded in these types of search.

• Explicit searches: The shopper enters text in the search field.
• Implicit searches: The shopper browses in the storefront.
• Product search suggestions: The shopper sees suggestions as the shopper enters text in the search field.

Predictive Sort calculates the affinity of an individual shopper to the products they view and purchase via these data sources.

• Catalogs and products
• Order history
• Live customer clickstreams

Predictive Sort saves a cookie on the shopper’s device that includes the shopper’s interest in specific products. This interest or assignment can change within a session and tracks both registered and guest shoppers. As it collects data, Predictive Sort learns about the shopper and personalizes the shopper’s sorting experience. For example, when a shopper looks at men’s sneakers and then does a search, products in the Men’s top-level category display at the top.

## Performance Considerations

Predictive Sort has caching considerations for the rendering templates and search requests. Because each shopper sees a personalized sort of their search results, caching the position of the search hits on the product grid isn't possible.

There’s no need to modify the caching setup in the rendering templates. B2C Commerce disables the caching of search hit positions in the results grid by default for requests that include a sorting rule with the Predictive Sort attribute. For example, if Brandon assigns a predictive sorting rule to the Sales category, B2C Commerce disables only caching for the Sales category results page. If he configures an A/B test with 5% traffic to a predictive sorting rule, B2C Commerce disables only caching for that 5% of requests.

## Configure Predictive Sort

Brandon wants to create two new sorting rules that use Predictive Sort.

• An existing sort rule
• A new sorting rule with dynamic attributes

## Existing Sorting Rule

Brandon starts with an existing sorting rule, because it lets him review before and after results to understand Predictive Sort’s impact. Here’s how he does it.

2. Click site > Merchant Tools > Search > Sorting Rules.
3. Click the Sorting Rules - Revenue sorting rule.

This sorting rule already sorts by three attributes: Revenue, Text Relevance, and Units Ordered.
2. Start typing Predictive Sort until the attribute appears and then select it.
3. Set Text Relevancy to No. Text Relevance is already included as an attribute.
4. Set Direction to Descending.
5. Click Apply.

This is the sort order of search results and how B2C Commerce breaks ties with the rule.

1. Text Relevance
2. Units Ordered
3. Predictive Sort

## New Sorting Rule with Dynamic Attributes

Brandon creates a new Predictive Sort attribute that contains blended dynamic attributes. Here’s how he does it.

1. Click Dynamic Attributes.

2. Click New and enter Predictive Sort as the name.
3. Add three attributes: Revenue, Text Relevance, and Predictive Sort.

4. Set the weights as follows:
• Revenue: 25%
• Text Relevance: 40%
• Predictive Sort: 35%
5. Set them all to Descending .
6. For both Revenue and Predictive Sort, set the default value to Minimum.
7. For Text Relevance, set the default value to Average.
8. Click Apply.

This new attribute, which can be used in a sorting rule, blends Revenue, Text Relevance, and Predictive Sort.

## User Experience Considerations

Brandon adds Predictive Sort to a current sorting rule, tests it against the current sorting rule in keyword search and category search, and then gives Predictive Sort a higher weight or moves it up in the sort order. If it’s assigned a low weight or isn’t high in the sort order, it might not have enough influence on the search scores to affect results.

## A/B Testing

Brandon wants to run A/B tests with Sorting Rule as the experience. But first, he needs to make sure that he enables A/B testing in Business Manager preferences.

Here’s how Brandon tests an Einstein sorting rule against a current sorting experience.

• Use the current sort experience as the test control (80%).
• Assign the current sort experience to Test Segment A as well (10%).
• Assign the Einstein Sorting Rule to Test Segment B (10%).
• Phase 1: Increase the percentage of traffic for Test Segment A & B to 25% each and run the test for 90 days, checking the progress every few weeks.
• Phase 2: Increase the percentage of traffic for Test Segment A & B to 45% each and run the test for another 90 days, checking the progress every few weeks.
• Final: Deploy the winner to 100% of traffic!

## Troubleshoot Predictive Sort

Brandon suspects that his sorts aren’t working as expected, so he wants to investigate. Here’s what he does.

• Navigate to the storefront and click the green information button on a product in the search results (or category grid page). If the search score for Predictive Sort is 0 or less, contact Customer Support.
• Use the Recommendation Validator to check that Predictive Sort is working.
• Use the Storefront Toolkit to view Search Information.

Brandon sees duplicate product tiles in category search results that use Predictive Sort. He checks that his developer added the Predictive Sort specific <iscache if=“\${!searchModel.isPersonalizedSort()}”/> declaration to the storefront's product grid rendering templates.

## Let's Wrap It Up

In this module, Brandon Wilson learned how to make his storefront’s search smarter with Commerce Cloud Einstein. He learned how using Search Dictionaries, Search Recommendations, and Predictive Sort help personalize storefront search.