On this page
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 main steps:
- Gathering user data, which breaks down into:
- Planning which user behavior to track
- Capturing user behavior by sending events
- Configuring your Personalization strategy—including simulating and testing your Personalization strategy
- Enabling Personalization in production
This page provides a high-level overview of those steps and links to the corresponding in-depth guides.
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, read articles, etc., they’re signalling preferences. In the context of Personalization, Algolia calls 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, it’s key to understand what behavior your users take 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 snippets of code in your front-end 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 front-end 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 and Conversion Analytics and other advanced features such as A/B testing and Dynamic Re-ranking.
Though there is significant overlap, the engine uses some of these events for Personalization purposes only. To have a unified strategy for events regardless of which features they’re ultimately used for, you should plan which user behavior to track before sending any events. Please 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 ensures that you can use the same events whatever the platform, for example, on your website and your mobile application.
Sending events requires coding.
Configuring your Personalization strategy
A Personalization strategy is the sum of the configuration choices you make to build accurate user affinity profiles. You need to configure Personalization because a one-size-fits-all approach to Personalization doesn’t work well. Different business objectives require different strategies.
Configuring your Personalization strategy comes down to three questions:
- Which events should you include, and how important are they relative to one another?
- Which facets should you include, and how important are they relative to one another?
- How significant an impact should Personalization play in your relevance?
You can learn more about how to make these decisions in the guide on configuring Personalization.
It’s best to 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 strong an impact Personalization should play in 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 in 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 key. You can use the Algolia dashboard to both 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:
- Enable Personalization at query time.
- 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.
Algolia provides tools to help your debug your Personalization implementation if it isn’t working as expected. First, you should ensure you’ve taken all the steps listed in the implementation checklist. If you have, you can use the Implementation help tab in the Personalization section of the dashboard.
Issues frequently come from improperly sent events. Please refer to the guide on validating events to make sure that you’re sending events correctly.