Guides / Personalization / Classic personalization

AI Personalization is now available in public beta. Migrate now to personalize search results based on historical and predictive user affinities.

Adding personalization to your Algolia search implementation gives your users a better search experience and increases engagement with your catalog. Implement personalization in three main steps:

  1. Gather user data, which breaks down into:

    • Planning which user behavior to track
    • Capturing user behavior by sending events
  2. Configure your personalization strategy, including simulating and testing
  3. Enable personalization in production

This page provides a high-level overview of those steps.

Planning which user behavior to track

Users’ behavior, both search and non-search related, give insight into their affinities. For example, when your users click on products, bookmark pages, visit category pages, add items to their cart, watch videos, and read articles, they’re signaling preferences. In the context of personalization, Algolia calls these user preferences “affinities.”

Each time a user engages in meaningful behavior, you can send an event to Algolia so that the engine can use it to build that user’s affinity profile. Before sending events, you must understand your users’ behavior and plan which ones you’ll collect. Without pre-analysis and planning, you could end up with a messy, inconsistent corpus of user data that will make later stages considerably harder.

Planning which user behavior to track doesn’t require coding.

Capturing user behavior by sending events

Once you’ve determined which behaviors you want to track, you need to send Algolia events that capture all the behaviors’ important aspects. These events give Algolia the user-based information needed to construct user affinity profiles. Sending events requires integrating short code snippets in your frontend components that correspond to your user behaviors. Suppose that adding a product to the shopping cart is a meaningful user behavior. Then you need to add code to the “Add to cart” button to send an event containing information about which user just added which product to the shopping cart.

You can refer to separate guides for how to send events to Algolia using the frontend libraries and API clients. A REST API, called the Insights API, lies beneath these clients and has a single endpoint. For this reason, Algolia sometimes refers to these events as “Insights events.” The engine uses many of the same events for Click, conversion, and revenue analytics and other advanced features such as A/B testing and Dynamic Re-ranking.

There is considerable overlap between these events, but the engine only uses some events for personalization. To consistently track activity, regardless of which features the data is used for, you should plan which user behaviors to monitor before sending any events. Refer to the guide on capturing user behavior as events for more information.

Because different event types require specific information, it’s best to use the clients, which offer distinct methods for sending different event types.

You can send events from anywhere in your website or application. It’s essential to be consistent with the naming and meaning of events throughout your application. Using the same event name for the same behavior means that you can use the same events, whatever the platform, for example, on your website and mobile application.

Sending events requires coding.

Configuring your personalization strategy

A personalization strategy is all the configuration choices required to build accurate user affinity profiles. You need to configure personalization because a one-size-fits-all approach doesn’t work well since different business objectives require different strategies.

Configuring your personalization strategy comes down to three questions:

  1. Which events should you include, and how important are they relative to one another?
  2. Which facets should you include, and how important are they relative to one another?
  3. How significant an impact should personalization have on your relevance?

You can learn more about how to make these decisions in the guide on configuring personalization.

Use the Personalization section of the Algolia dashboard to configure your strategy.

In the dashboard, you can select which events and facets to include and how strongly to weight them when creating user affinity profiles. For example, you can make purchasing a product a stronger signal than liking it and brand a more important facet than color. You can also decide how much of an impact Personalization will have on your relevance.

Configuring your personalization strategy doesn’t require coding.

Simulating and testing your personalization strategy

Knowing how important each event and facet should weigh in your strategy can be tricky. Though you may know that purchasing is a stronger signal than liking, it can be hard to decide how much stronger it should be. Similarly, you may not know how much of a role you want Personalization to play in your ranking.

That’s why the Personalization section of the dashboard includes a simulator. The simulator lets you simulate the effect of potential strategies on real user profiles before actually putting the strategy into production.

Even after configuring a strategy that you’ve vetted by simulating multiple users, it’s best to use the A/B testing feature. The feature lets you test personalization on some percentage of your users before adopting it wholesale.

Personalization can have enormous consequences for your relevance and search experience. Careful planning and caution in each step of the process are essential. Use the Algolia dashboard to simulate your strategy and run A/B tests.

Simulating and testing your personalization strategy doesn’t require coding.

Enabling personalization in production

For your users to receive personalized results, you need to do two things:

  1. Enable personalization at query time.
  2. Let Algolia know which user is making which query.

To enable personalization, you can either pass enablePersonalization as a search parameter at query time or enable enablePersonalization in your index settings. If you enable enablePersonalization as an index setting, every query made to that index uses personalization by default unless overridden at query time.

Whether you set enablePersonalization at query time or at the index level, you must send a user’s userToken with each query you want to personalize. Without it, Algolia doesn’t know which user affinity profile to apply to personalize the results.

Enabling personalization in production requires coding.

Debugging personalization

Algolia provides tools to help you debug your personalization implementation if it isn’t working as expected. First, you should ensure you’ve taken all the steps in the implementation checklist. If you have, use the Implementation help tab in the Personalization section of the dashboard.