It’s recommended to use the Kotlin API client, which is better suited for Android development.
The region
Personalization is specific to a region. As such, you should use the region where your personalization data is stored and processed. View your analytics region.
1
2
3
4
5
6
7
8
9
| use Algolia\AlgoliaSearch\PersonalizationClient;
$personalization = PersonalizationClient::create(
'YourApplicationID',
'YourAdminAPIKey',
'eu' // defaults to 'us'
);
$strategy = $personalization->getPersonalizationStrategy();
|
1
2
3
| personalization = Algolia::Personalization::Client.create('YourApplicationID', 'YourAdminAPIKey')
personalization.get_personalization_strategy
|
1
2
3
4
5
6
7
8
9
10
11
| const client = algoliasearch('YourApplicationID', 'YourAdminAPIKey');
const personalization = client.initPersonalization{
region: 'eu' // defaults to 'us'
appId: 'YourApplicationID', // defaults to the client credentials
apiKey: 'YourAdminAPIKey', // defaults to the client credentials
});
personalization.getPersonalizationStrategy().then(strategy => {
console.log(strategy);
});
|
1
2
3
4
5
6
7
8
9
| from algoliasearch.personalization_client import PersonalizationClient
personalization = PersonalizationClient.create(
'YourApplicationID',
'YourAdminAPIKey',
'eu' // defaults to 'us'
)
strategy = personalization.get_personalization_strategy()
|
1
2
3
4
5
6
7
8
9
10
11
| let personalizationClient = PersonalizationClient(
appID: "YourApplicationID",
apiKey: "YourAdminAPIKey",
region: .init(rawValue: "eu") // defaults to 'us'
)
personalizationClient.getPersonalizationStrategy { result in
if case .success(let response) = result {
print("Response: \(response)")
}
}
|
1
2
3
4
| PersonalizationClient personalizationClient = new PersonalizationClient(
"YourApplicationID",
"YourAdminAPIKey",
"eu");
|
1
2
3
4
5
6
7
8
9
10
11
12
| HttpRequester httpRequester = new MyCustomRequester();
PersonalizationConfig personalizationConfig = new PersonalizationConfig
.Builder("YourApplicationID", "YourAdminAPIKey", "eu")
.build();
PersonalizationClient personalizationClient = new PersonalizationClient(personalizationConfig, httpRequester);
// Apache client
PersonalizationClient personalizationClient = DefaultPersonalizationClient.create("YourApplicationID", "YourAdminAPIKey", "eu");
// Sync version
personalizationClient.getPersonalizationStrategy();
// Async version
personalizationClient.getPersonalizationStrategyAsync();
|
1
2
3
| client := personalization.NewClient("YourApplicationID", "YourAdminAPIKey", region.EU)
strategy, err := client.GetPersonalizationStrategy()
|
1
2
| val client = new AlgoliaClient("YourApplicationID", "YourAdminAPIKey")
client.personalizationHost = "https://personalization.eu.algolia.com" // defaults to 'us'
|
1
2
3
4
5
6
7
| val clientPersonalization = ClientPersonalization(
ApplicationID("YourApplicationID"),
APIKey("YourAdminAPIKey"),
Region.Personalization.EU
)
clientPersonalization.getPersonalizationStrategy()
|