Prepare your search implementation
On this page
AI Personalization is a beta feature according to Algolia’s Terms of Service (“Beta Services”).
Once you’ve prepared your event implementation, focus on your search implementation.
Attach user tokens to queries
To ensure that AI Personalization can understand each user’s journey and continuously improve their personalization experience, attach a user token to each query. The user tokens attached to the queries must match the user tokens sent with events.
Attach user tokens with InstantSearch
To include the userToken
in your search queries using InstantSearch, use the configure
widget to set the userToken
search parameter.
1
2
3
instantsearch.widgets.configure({
userToken: 'user-1234',
});
Attach user tokens with an API client
To include the userToken
in your search queries with an API client, use the search
method to send the userToken
search parameter.
1
2
3
$index->search('query', [
'userToken' => 'user-1234'
]);
Persist user tokens
For user profiles to be found and retrieved at search time, you should persist anonymous user tokens and authenticated user tokens across sessions.
Avoid enabling personalization at query time
Rather than using the enablePersonalization
search parameter at query time, set it in the index settings when moving to production. This lets you A/B test the impact of personalization without having to modify code.
Next step
Now that you’ve prepared your index structure, event implementation and search implementation, AI Personalization can build a holistic view of each user’s journey and personalize search results accordingly.
You’re ready to configure AI Personalization indices without additional code changes.