This client is new in v5 of the JavaScript API clients.

The Analytics API client is part of the algoliasearch package. To install this package, run:

1
npm install algoliasearch

To use the Analytics client:

1
2
3
4
import { algoliasearch } from "algoliasearch";

const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const analyticsClient = client.initAnalytics({ region: "ALGOLIA_APPLICATION_ID_REGION" });

Replace ALGOLIA_APPLICATION_ID_REGION with your Algolia application’s analytics region: us for the United States or de 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 Analytics API client, you can install its package on its own:

1
npm install @algolia/client-analytics

To use it, run:

1
2
3
4
5
6
7
import { analyticsClient } from "@algolia/client-analytics";

const client = analyticsClient(
  "ALGOLIA_APPLICATION_ID",
  "ALGOLIA_API_KEY",
  "ALGOLIA_APPLICATION_ID_REGION"
);

List of methods

Each method makes one request to the Analytics API.

Searches

Clicks

Users

Filters

Revenue

Status

Did you find this page helpful?