Personalization API client
The personalization API client is part of the algoliasearch package.
To install this package, run:
1
npm install algoliasearch
To use the personalization client:
1
2
3
4
import { algoliasearch } from "algoliasearch";
const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const personalizationClient = client.initPersonalization({ region: "ALGOLIA_APPLICATION_ID_REGION" });
Replace ALGOLIA_APPLICATION_ID_REGION with your Algolia application’s analytics region: us for the United States or eu for Europe.
You can check your analytics region in the Infrastructure > Analytics section of the Algolia dashboard.
The algoliasearch package includes API clients for the Search, Recommend, Analytics, A/B testing, and Personalization API.
If you just want to use the personalization API client, you can install its package on its own:
1
npm install @algolia/client-personalization
To use it, run:
1
2
3
4
5
6
7
import { personalizationClient } from "@algolia/client-personalization";
const client = personalizationClient(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
"ALGOLIA_APPLICATION_ID_REGION"
);
List of methods
Each method makes one request to the Personalization API.
Profiles
| client.getUserTokenProfile | Retrieve a user profile |
| client.deleteUserProfile | Delete a user profile |
Strategies
| client.getPersonalizationStrategy | Retrieve the personalization strategy |
| client.setPersonalizationStrategy | Define the personalization strategy |