Concepts / Getting insights and analytics / Personalization
Jun. 28, 2019


The what and why of personalization

Personalization is significant to any interactive search, as it adds a personal layer to the overall relevance experience. By integrating analytics-based user preferences into the query experience, you expand the possibilities of search. Personalized search is an essential addition to Algolia’s full set of relevance tools, which includes proper indexing, custom ranking, analytics, and merchandising with Query Rules.

Relevance has two goals

Effective relevance benefits you in two ways: first, it enables your end users to see products and services that match their expectations; second, it provides results that align with your business needs. These twin goals are accomplished with a well-structured and smartly configured index. This happens all before you personalize results. You want to be sure that the same search on the same index always returns the same results.

But we also know that users greatly benefit from seeing individualized results. Queries mean different things for different people. For example, a user who searches for “harry”, and has a preference for children’s literature, will want to see “Harry Potter” results to appear on the first page. Politically-minded users, however, will be more interested in seeing “Harry Truman” instead of “Harry Potter” in their results.

It benefits your business as well. Personalization encourages people to stay longer on your website, leads to more discovery of your products, and generates more interest and sales.

So where does personalization fit within Algolia’s relevance strategy?

Personalization introduces an additional, user-based layer on top of Algolia’s relevance strategy. First, there is textual relevance - an intelligent and robust textual matching that includes typo tolerance, synonyms, filtering, and a host of other settings; second, business relevance - a business-centric relevance that ranks results according to business metrics; third, merchandising - promoting specific items, and displaying banners and top results. All of these contribute, in different ways, to producing relevant results that apply equally to everybody. Personalization - and more broadly Algolia’s Insights & Analytics - adds a fourth layer by injecting user preferences into the relevance formula.

Creating reliable preferences - facets

Before jumping into implementation, it’s necessary to understand the key to any successful personalized experience. Personalization relies almost exclusively on facets. User preferences come from the categories (facets) of items that a user frequently interacts with. For example, a user can have a preference for a certain author or genre when searching books, sport items while looking for clothing, or gaming software while looking for media.

Algolia derives most facet-value preferences from the actions users take on individual products, not on the facets they click on. If you want to find out which authors a user likes to buy, you will want Algolia to know every book the user buys. Algolia automatically derives the associated authors from these transactions and saves them as preferences to its Personalization system. You can also tell Algolia whenever a user clicks on a facet, which they will do when browsing or discovering your products. Facet-clicking leads to great insights; however, for most implementations, the best data will come from the buying habits of individual products.

How to do it: three steps

There are 3 steps to creating a personalized search experience for your users, all equally important.

1. Prerequisite: Collect user events

Personalization starts with gathering data about your user’s actions. You can send us any type of event that you think is relevant for personalization. For example, you can send an event when the user clicks on a product, and/or bookmarks, likes, visits a category page, adds something to their cart, watches a video, reads an article, etc.

To gather data, you’ll need to take two steps:

  • Non-coding part: pre-analysis. You need to think about what kind of events best reflect a user’s preferences. If a user keeps buying Apple products, this is a good indication of a preference for the Apple brand. On the other hand, if your users tend to randomly create favorites, then favorites should be ignored as preferences, or set to score lower than buying tendencies. Note that you can send events from anywhere in your application and filter out the ones you don’t need later on.

  • Coding part: sending events. Once you’ve determined which events you want to capture, you need to add single-line snippets of code to the parts of your front-end code that manage those events.

Together, these actions will give Algolia the user-based information it needs to construct user preferences. Algolia needs to know which actions your users take, and which products they take those actions on.

2. Configure personalization strategy

You can use the dashboard to define how user events should be interpreted. There, you create distinct scores for each type of user action, making some actions more important than others (for example, purchasing a product is a stronger signal than liking it). As you’ll see, this comparative scoring forms the basis of determining user preferences.

Managing user events requires no coding. This is normally done in the Dashboard.

3. Enable personalization at query time

To see personalized results, you need to enable personalization at query time. This can be done for some or all queries and requires the least amount of effort on your part. All you need is to tell Algolia whether or not to apply the current user’s preferences.

To enable personalization, all you have to do is pass the enablePersonalization and userToken search parameters.

Example use cases

As with all of personalization, these examples require both technical and non-technical thinking/actions:

  • Coding is required for sending events and enabling personalization on every search.
  • The Dashboard is for configuring the personalization strategy.

Example 1: Movies added to watch list

On a website like Netflix, you can add movies to your watch list. These are movies that you want to see later. Let’s say you’ve added the movie Ocean’s Thirteen to your watch list: if later you search for “Ocean”, it will make sense to have this specific movie show up at the top of the result list.

  1. Coding: Every time someone adds something to their watch list, send us the following information:
    • the user identifier (userToken),
    • the movie identifier,
    • the event type (could be either click, view or conversion),
    • an event name like “Add to watch list”.
  2. Coding: Send us the userToken of the user when making a search
  3. Dashboard: Configure a high score for the event “Add to watch list”, and a low score for every other event
  4. That’s it! Movies added to a user’s watch list will now be ranked higher in their search results.

Example 2: Recurring purchases on a fashion e-commerce website

On a website like Asos, where users return to shop often, it makes sense to showcase the type of products that corresponds to their usual taste.

To implement this, you need to:

  1. Coding: Every time someone makes a purchase, send us the following event:
    • the user identifier (userToken),
    • the movie identifier,
    • the event type (conversion),
    • an event name, like “purchase”.
  2. Coding: Send us the userToken of the user when making a search
  3. Dashboard: Configure a high score for the event “Purchase”, and a low score for every other event
  4. Dashboard: Configure a high score for all characteristics of products that are relevant to find related items (brand, tags, size, etc.), and a low score for the others (price, color, etc.)
  5. That’s it!

Did you find this page helpful?