It’s recommended to use the Kotlin API client, which is better suited for Android development.
We released a new version of the JavaScript API client in public beta.
Read the beta documentation for more information.
We released a new version of the PHP API client in public beta.
Read the beta documentation for more information.
We released a new version of the Java API client in public beta.
Read the beta documentation for more information.
A/B testing region
Your Analytics data is stored and processed in a specific region: either in Europe (Germany), or in the United States.
When initializing the Analytics client, you need to select your analytics region:
1
2
3
4
5
6
7
8
9
10
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
use Algolia\AlgoliaSearch\AnalyticsClient;
// You need an API key with `setSettings` permissions
$analytics = AnalyticsClient::create(
'YourApplicationID',
'YourAPIKey',
'de' // Default: "us"
);
|
1
2
3
4
5
6
7
8
9
10
| # Installation instructions:
# https://www.algolia.com/doc/api-client/getting-started/install/
require 'algolia'
# You need an API key with `setSettings` permissions
analytics = Algolia::Analytics::Client.create(
'YourApplicationID',
'YourAPIKey',
'de' # Default: 'us'
)
|
1
2
3
4
5
6
7
8
9
10
11
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
const algoliasearch = require('algoliasearch');
// You need an API key with `setSettings` permissions
const client = algoliasearch('YourApplicationID', 'YourAPIKey');
const analytics = client.initAnalytics({
appId: 'YourApplicationID',
apiKey: 'YourAPIKey',
region: 'de' // Default: 'us'
});
|
1
2
3
4
5
6
7
8
9
10
| # Installation instructions:
# https://www.algolia.com/doc/api-client/getting-started/install/
from algoliasearch.analytics_client import AnalyticsClient
# You need an API key with `setSettings` permissions
analytics = AnalyticsClient.create(
"YourApplicationID",
"YourAPIKey",
"de" # Default: "us"
)
|
1
2
3
4
5
6
7
8
9
10
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import AlgoliaSearchClient
// You need an API key with `setSettings` permissions
let client = AnalyticsClient(
appID: "YourApplicationID",
apiKey: "YourAPIKey",
region: .de // Default: .us
)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import com.algolia.search.model.APIKey
import com.algolia.search.model.ApplicationID
import com.algolia.search.client.ClientAnalytics
import com.algolia.search.configuration.Region.Analytics.EU
// import.com.algolia.search.configuration.Region.Analytics.US
suspend fun main() {
// You need an API key with `setSettings` permission
val client = ClientAnalytics(
applicationID = ApplicationID("YourApplicationID"),
apiKey = APIKey("YourAPIKey"),
region = EU // default: US
)
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
using Algolia.Search.Clients;
class Program
{
public static void Main(string[] args)
{
// You need an API key with `setSettings` permissions
var client = new AnalyticsClient(
"YourApplicationID",
"YourAPIKey",
"de", // Default: "us"
)
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import com.algolia.search.DefaultAnalyticsClient;
import com.algolia.search.AnalyticsClient;
public class Program {
public static void main(String[] args) {
// You need an API key with `setSettings` permissions
AnalyticsClient client = DefaultAnalyticsClient.create(
"YourApplicationID",
"YourAPIKey",
"de" // Default: "us"
);
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
package main
import (
"github.com/algolia/algoliasearch-client-go/v3/algolia/analytics"
"github.com/algolia/algoliasearch-client-go/v3/algolia/region"
)
func main() {
// You need an API key with `setSettings` permissions
client := analytics.NewClientWithConfig(
analytics.Configuration{
AppID: "YourApplicationID",
APIKey: "YourAPIKey",
Region: region.DE, // Default: `region.US`
},
)
}
|
1
| You can't select your Analytics region with the Scala API client.
|
You can check the region for your account in the Algolia dashboard.