Guides / Getting insights and analytics / Personalization

Personalizing Results

Adding Personalization to your Algolia search implementation gives your users a better search experience and increases engagement with your catalog. You can implement Personalization in three steps. This page provides a high level overview of those steps, and a couple Personalization use cases.

Gathering data

To implement Personalization, you first need to gather data on your users’ actions. You should capture events that clarify or specify user behavior. For example, you can send events when your users: click on products, bookmark pages, like products, visit category pages, add something to their cart, watch videos, read articles, etc.

Gathering data involves two steps: pre-analysis and sending events, the second of which involves coding.

  1. Pre-analysis. You need to think about the kind of events that best reflect your users’ preferences. For example, a user repeatedly buying Apple products is a good indication of a preference for the Apple brand.
  2. 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 that manage your target 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.

You can send events from anywhere in your application, and later on filter out the ones you don’t need, when defining your Personalization strategy. It’s important to be consistent with the naming and meaning of your events throughout your application. By using the same event definition for the same actions, you ensure that you can use the same event collections whatever the platform (e.g., on your website and your mobile application).

Configure Personalization strategy

You can use the Algolia dashboard to define which user events to use for Personalization, as well as how to interpret them. From the Algolia dashboard, you can create distinct scores for each type of user action, making some more important than others. For example, you can make purchasing a product a stronger signal than liking it. You can also test how your Personalization strategy impacts search results for different users.

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.

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 little work. You only need to tell Algolia whether or not to apply the current user’s preferences for specific queries.

To enable Personalization, pass the enablePersonalization and userToken search parameters with your queries. You can also set enablePersonalization in your index settings, so that every query in your index uses Personalization.

Example use cases

As with all of Personalization, these examples require both technical and non-technical actions:

  • Coding is required for sending events and enabling Personalization on every search.
  • The Dashboard is required for configuring and testing your Personalization strategy.

Example 1: Movies added to a 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 one of your users has added the movie “Ocean’s Thirteen” to their watch list: if they later search for “Ocean”, it will make sense to have “Ocean’s Thirteen” show up at the top of their result list.

  1. Coding: Every time someone adds a movie to their watch list, send the following event to your Algolia application:
    • 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 a user’s userToken whenever they make a search.
  3. Dashboard: Add a high weight to the “Add to watch list” event, and a lower weight to other events.
  4. That’s it! Movies added to a user’s watch list are now ranked higher in their search results.

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

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

To implement this, you need to:

  1. Coding: Every time someone makes a purchase, send the following event to your Algolia application:
    • the user identifier (userToken),
    • the item identifier,
    • the event type (conversion),
    • an event name, like “purchase”.
  2. Coding: Send a user’s userToken whenever they make 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 product characteristics that categorize 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?