How Personalization Works
On this page
Personalization provides individualized ranking to users based on their past behavior. A user’s behavior implicitly reveals their preferences and interests—what Algolia refers to as “affinities.” This guide explains how Algolia calculates user affinities based on user behavior and how user affinity scores are applied to results.
Defining user affinities based on facets
Basing Personalization on individual items is inefficient. Users tend to have affinities not for particular items but rather for categories of items.
For example, a user can have an affinity for athletic wear while shopping for clothing, non-fiction works when browsing through books, or pop music when listening to music. These different categories correlate with facets in your data. Thus, to personalize search results, Algolia’s engine needs to understand which categories, that is, facets, your user has an affinity for. Personalization relies on facets to understand user affinities and promote results accordingly.
Take an online media store as an example. To personalize search results, it’s more important to know the genres, authors, and artists behind the media a user has consumed, rather than the individual titles. When the engine knows the categories a user likes, it can personalize results based on these affinities. It does so by boosting the corresponding facets values.
For example, imagine a user who purchased children’s books and other media in the past. Suppose they search for “poetry.” In that case, the engine can return book results from Shel Silverstein, Dr. Seuss, and other children’s poets. For another user who has shown an affinity for Korean film, it can boost the 2010 Korean drama “Poetry” for this search. In both cases, textual relevance is the first step, but personalizing results depends on the facets involved in the user’s past behavior.
Translating user behavior into affinities through events
Users’ behaviors, both search and non-search related, give insight into their affinities. Examples of meaningful behavior are whenever a user views, clicks on, likes, favorites, bookmarks, or purchases a particular item or category. When a user interacts with a particular item or category, the engine considers the facet values that represent the item or category to understand the user’s affinities.
User behavior reaches Algolia in the form of standardized events. Each time a user engages in meaningful behavior, you need to send an event to Algolia so that the engine can use it to build that user’s affinity profile. To build the most nuanced and relevant user profiles, it’s necessary to gather as much data as possible.
If you’re unsure of what kinds of events matter, see Planning which events to send. Without a large corpus of user data and a well-considered Personalization strategy, Personalization can lead to the wholesale promotion of some categories over others.
Understanding scoring
There are three layers of scoring in Personalization: sending events, building user affinity profiles based on facets, and applying the profiles based on your Personalization strategy.
Building user affinities begins with collecting events. Though you may collect a wide variety of events, for example, viewing a category page, clicking on a product page, liking an item, sharing an item, and adding an item to the shopping cart, it’s unlikely that each of these events should have the same weight when personalizing results. For example, adding an item to the shopping cart is likely a stronger indicator of affinity than viewing its product detail page. You can fine-tune each event type’s weight in your Personalization strategy.
After setting your strategy and simulating, you may also decide that certain events don’t offer any meaningful information. That’s alright—just because you’ve collected certain events doesn’t mean you need to include them all in your strategy.
Though events can be item-based or category-based, Algolia always extracts the underlying facets to build user affinity profiles. The engine stores all underlying facet information gathered from events so that you can simulate the effects of including different facets in your Personalization strategy. In production, the engine only applies Personalization on the facets you deem important by including them in your strategy.
For example, a clothing store may have listed category, color, price, brand, material, and size as attributesForFaceting
to let users filter on them when searching. However, just because a user buys a green sweater, it doesn’t mean they’ll buy green items from now on. While brand, category, and size are probably strong indicators of a user’s affinities, color may be less so. Just like with events, you can set the each facet’s weight within your Personalization strategy or leave them out altogether.
When ranking search results, Algolia integrates Personalization into the relevance strategy so that it doesn’t override the textual, business, or merchandising relevance you’ve already set up. Even so, you can also change the overall impact Personalization plays. Please refer to the guide on configuring Personalization for more information on setting the impact of events, facets, and Personalization as a whole.
Enabling Personalization at query time
You can enable Personalization as an index setting or at query time via the enablePersonalization
setting. Before putting Personalization into production, it’s best to simulate its effects within your dashboard and testing it with the A/B testing feature. Check out the implementation overview as well as further details on all implementation steps, including what to do before going to production, in the personalizing results guides .