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\RecommendationClient;
$recommendation = RecommendationClient::create(
'YourApplicationID',
'YourAdminAPIKey',
'eu' // defaults to 'us'
);
$strategy = $recommendation->getPersonalizationStrategy();
|
1
2
3
| recommendation = Algolia::Recommendation::Client.create('YourApplicationID', 'YourAdminAPIKey')
recommendation.get_personalization_strategy
|
1
2
3
4
5
6
7
8
9
10
11
| const client = algoliasearch('YourApplicationID', 'YourAdminAPIKey');
const recommendation = client.initRecommendation({
region: 'eu' // defaults to 'us'
appId: 'YourApplicationID', // defaults to the client credentials
apiKey: 'YourAdminAPIKey', // defaults to the client credentials
});
recommendation.getPersonalizationStrategy().then(strategy => {
console.log(strategy);
});
|
1
2
3
4
5
6
7
8
9
| from algoliasearch.recommendation_client import RecommendationClient
recommendation = RecommendationClient.create(
'YourApplicationID',
'YourAdminAPIKey',
'eu' // defaults to 'us'
)
strategy = recommendation.get_personalization_strategy()
|
1
2
3
4
5
6
7
8
9
10
11
| let recommendationClient = RecommendationClient(
appID: "YourApplicationID",
apiKey: "YourAdminAPIKey",
region: .init(rawValue: "eu") // defaults to 'us'
)
recommendationClient.getPersonalizationStrategy { result in
if case .success(let response) = result {
print("Response: \(response)")
}
}
|
1
2
3
4
| RecommendationClient recommendationClient = new RecommendationClient(
"YourApplicationID",
"YourAdminAPIKey",
"eu");
|
1
2
3
4
5
6
7
8
9
10
11
12
| HttpRequester httpRequester = new MyCustomRequester();
RecommendationConfig recommendationConfig = new RecommendationConfig
.Builder( "YourApplicationID", "YourAdminAPIKey", "eu")
.build();
RecommendationClient recommendationClient = new RecommendationClient(recommendationConfig, httpRequester);
// Apache client
RecommendationClient recommendationClient = DefaultRecommendationClient.create("YourApplicationID", "YourAdminAPIKey", "eu");
// Sync version
recommendationClient.getPersonalizationStrategy();
// Async version
recommendationClient.getPersonalizationStrategyAsync();
|
1
2
3
| client := recommendation.NewClient("YourApplicationID", "YourAdminAPIKey", region.EU)
strategy, err := client.GetPersonalizationStrategy()
|
1
2
| val client = new AlgoliaClient("YourApplicationID", "YourAdminAPIKey")
client.recommendationHost = "https://recommendation.eu.algolia.com" // defaults to 'us'
|
1
2
3
4
5
6
| val clientRecommendation = ClientRecommendation(
ApplicationID("YourApplicationID"),
APIKey("YourAdminAPIKey"),
Region.Recommendation.EU
)
clientRecommendation.getPersonalizationStrategy()
|