Concepts / Getting insights and analytics / Personalization
Jan. 07, 2019

Personalization

Personalization is significant to any conversational 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. Your initial focus is on all users, not individual ones. You want to make 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 you as well. Personalization encourages people to stay longer on your website, leads to more discovery of your products, and generates more interest and sales.

Where Personalization Fits With Algolia’s Relevance Strategy

Algolia’s Personalization feature therefore introduces a 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.

Implementation - Three Steps to Take

All three steps are of equal importance. They are summarized here. We go into more detail in the following section.

1. Gather user events

Personalization starts with gathering data about your user’s actions. You can send us any type of events that you think are relevant for Personalization. For example, you can send an event when the user clicks on a product, 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 add single-line snippets of code to different parts of your front end. This gives Algolia the user-based information it needs to construct user preferences. Algolia needs to know what actions your users take, and which products they take these actions on.

2. Build a list of preferences for each user

You can use the dashboard to define how the 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.

3. Activate the user preferences at query time

Here we come to the main objective: to have user preferences directly impact the finding and ranking of personally relevant results. This can be done for each query, 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. You can set it on and off for each individual search.

Technical Specs

What follows is a summary of the personalization parameters. The full technical documentation can be found in our Personalization Rest API reference page.

Unique user identifier

It can be any kind of userToken, for example a user ID that you manage on your back end, or the user’s HTTP request IP.

Event type

The eventType helps categorize your events. Events fall into three categories: View, Click, and Conversion. See explanation and examples above.

Event name

The eventName can be a name of your choosing. See examples above.

The record’s objectID

The objectID of the item in your index that you wish to associate with the event.

The search’s queryID

The queryID is the ID of the currently active query.

Filters you consider relevant

The filters parameter is the exact name of the attribute that you use for filtering and faceting.

enablePersonalization

The boolean flag used during query time to allow user preferences to be used as part of the relevance and ranking process. When flagged as true, user preferences are taken into account, when false, user preferences are ignored.

Example Use Cases

Let’s see two basic examples to illustrate how it works.

Example 1: Movies added to watch list

On a website like Netflix, you can add movies to your watch list. Movies in your watch list are movies that you want to see later. Let’s say for example that 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.

To implement this, you need to:

  1. Every time someone adds something to their watch list, send us the following event:
    • userToken: The user identifier
    • eventType: “Favorite”
    • eventName: “Add to watch list”
    • objectID: The movie identifier
  2. Configure a high score for the event “Add to watch list”, and a low score for every other event
  3. Send us the userToken of the user when making a search
  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. Every time someone makes a purchase, send us the following event:
    • userToken: The user identifier
    • eventType: “Conversion”
    • eventName: “Purchase”
    • objectID: The movie identifier
  2. Configure a high score for the event “Purchase”, and a low score for every other event
  3. 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.)
  4. Send us the userToken of the user when making a search
  5. That’s it!

Did you find this page helpful?