The generated API clients are a work in progress, you can also find our stable clients on the Algolia documentation.

Skip to main content

Analytics API (2.0.0)

Download OpenAPI specification:Download

The Analytics API gives you access to metrics related to your Algolia search experience.

Base URLs

The base URLs for requests to the Analytics API are:

  • https://analytics.us.algolia.com (alias: https://analytics.algolia.com)
  • https://analytics.de.algolia.com

Use the URL that matches your analytics region.

All requests must use HTTPS.

Availability and authentication

Access to the Analytics API is available as part of the Premium or Elevate plans.

To authenticate your API requests, add these headers:

  • x-algolia-application-id. Your Algolia application ID.
  • x-algolia-api-key. An API key with the necessary permissions to make the request. The required access control list (ACL) to make a request is listed in each endpoint's reference.

You can find your application ID and API key in the Algolia dashboard.

Rate limits

You can make up to 100 requests per minute per app to the Analytics API. The response includes headers with information about the limits.

Parameters

Query parameters must be URL-encoded. Non-ASCII characters must be UTF-8 encoded. Plus characters (+) are interpreted as spaces.

Response status and errors

The Analytics API returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response.

Successful responses return a 2xx status. Client errors return a 4xx status. Server errors are indicated by a 5xx status. Error responses have a message property with more information.

Version

The current version of the Analytics API is version 2, as indicated by the /2/ in each endpoint's URL.

Searches

Metrics related to searches and search results, such as the no-results rate or the most frequent search queries.

Retrieve top searches

Returns the most popular search terms.

acl: ["analytics"]
query Parameters
clickAnalytics
boolean
Default: false

Whether to include metrics related to click and conversion events in the response.

direction
string
Default: "asc"
Enum: "asc" "desc"

Sorting direction of the results: ascending or descending.

endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

orderBy
string
Default: "searchCount"
Enum: "averageClickPosition" "clickThroughRate" "conversionRate" "searchCount"

Attribute by which to order the response items.

If the clickAnalytics parameter is false, only searchCount is available.

revenueAnalytics
boolean
Default: false

Whether to include revenue-related metrics in the response.

If true, metrics related to click and conversion events are also included in the response.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopSearchesAsync("index");

Response samples

Content type
application/json
Example
{
  • "searches": [
    ]
}

Retrieve number of searches

Retrieves the number of searches within a time range, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetSearchesCountAsync("index");

Response samples

Content type
application/json
{
  • "count": 2,
  • "dates": [
    ]
}

Retrieve top searches without results

Retrieves the most popular searches that didn't return any results.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetSearchesNoResultsAsync("index");

Response samples

Content type
application/json
{
  • "searches": [
    ]
}

Retrieve no results rate

Retrieves the fraction of searches that didn't return any results within a time range, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetNoResultsRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.49,
  • "count": 504,
  • "noResultCount": 54,
  • "dates": [
    ]
}

Retrieve top search results

Retrieves the object IDs of the most frequent search results.

acl: ["analytics"]
query Parameters
clickAnalytics
boolean
Default: false

Whether to include metrics related to click and conversion events in the response.

endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

revenueAnalytics
boolean
Default: false

Whether to include revenue-related metrics in the response.

If true, metrics related to click and conversion events are also included in the response.

search
string
Example: search=enable ab test

Search query.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopHitsAsync("index");

Response samples

Content type
application/json
Example
{
  • "hits": [
    ]
}

Clicks

Metrics related to click and conversion events, such as click- and conversion rates for your search results.

Retrieve top searches without clicks

Retrieves the most popular searches that didn't lead to any clicks, from the 1,000 most frequent searches.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetSearchesNoClicksAsync("index");

Response samples

Content type
application/json
{
  • "searches": [
    ]
}

Retrieve no click rate

Retrieves the fraction of searches that didn't lead to any click within a time range, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetNoClickRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.15,
  • "count": 2,
  • "noClickCount": 15,
  • "dates": [
    ]
}

Retrieve average click position

Retrieves the average click position of your search results, including a daily breakdown.

The average click position is the average of all clicked search results' positions. For example, if users only ever click on the first result for any search, the average click position is 1. By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetAverageClickPositionAsync("index");

Response samples

Content type
application/json
{
  • "average": 2.035,
  • "clickCount": 162,
  • "dates": [
    ]
}

Retrieve click positions

Retrieves the positions in the search results and their associated number of clicks.

This lets you check how many clicks the first, second, or tenth search results receive.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetClickPositionsAsync("index");

Response samples

Content type
application/json
{
  • "positions": [
    ]
}

Retrieve click-through rate

Retrieves the click-through rate for all of your searches with at least one click event, including a daily breakdown

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetClickThroughRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.49,
  • "clickCount": 162,
  • "trackedSearchCount": 2,
  • "dates": [
    ]
}

Retrieve conversion rate

Retrieves the conversion rate for all of your searches with at least one conversion event, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetConversionRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.05,
  • "trackedSearchCount": 2,
  • "conversionCount": 10,
  • "dates": [
    ]
}

Retrieve add-to-cart rate

Retrieves the add-to-cart rate for all of your searches with at least one add-to-cart event, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetAddToCartRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.1,
  • "trackedSearchCount": 2,
  • "addToCartCount": 10,
  • "dates": [
    ]
}

Retrieve purchase rate

Retrieves the purchase rate for all of your searches with at least one purchase event, including a daily breakdown.

By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetPurchaseRateAsync("index");

Response samples

Content type
application/json
{
  • "rate": 0.05,
  • "trackedSearchCount": 2,
  • "purchaseCount": 10,
  • "dates": [
    ]
}

Retrieve revenue data

Retrieves revenue-related metrics, such as the total revenue or the average order value.

To retrieve revenue-related metrics, sent purchase events. By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetRevenueAsync("index");

Response samples

Content type
application/json
{
  • "currencies": { },
  • "dates": [
    ]
}

Revenue

Metrics related to revenue.

Filters

Metrics related to filters.

Retrieve top filters

Retrieves the most frequently used filter attributes.

These are attributes of your records that you included in the attributesForFaceting setting.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

search
string
Example: search=enable ab test

Search query.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopFilterAttributesAsync("index");

Response samples

Content type
application/json
{
  • "attributes": [
    ]
}

Retrieve top filter values

Retrieves the most frequent filter (facet) values for a filter attribute.

These are attributes of your records that you included in the attributesForFaceting setting.

acl: ["analytics"]
path Parameters
attribute
required
string
Example: brand

Attribute name.

query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

search
string
Example: search=enable ab test

Search query.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopFilterForAttributeAsync("myAttribute", "index");

Response samples

Content type
application/json
{
  • "values": [
    ]
}

Retrieve top filters for a search without results

Retrieves the most frequently used filters for a search that didn't return any results.

To get the most frequent searches without results, use the Retrieve searches without results operation.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

search
string
Example: search=enable ab test

Search query.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopFiltersNoResultsAsync("index");

Response samples

Content type
application/json
{
  • "values": [
    ]
}

Users

Metrics related to the users of your search.

Retrieve number of users

Retrieves the number of unique users within a time range, including a daily breakdown.

Since this endpoint returns the number of unique users, the sum of the daily values might be different from the total number.

By default, Algolia distinguishes search users by their IP address, unless you include a pseudonymous user identifier in your search requests with the userToken API parameter or x-algolia-usertoken request header. By default, the analyzed period includes the last eight days including the current day.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetUsersCountAsync("index");

Response samples

Content type
application/json
{
  • "count": 0,
  • "dates": [
    ]
}

Retrieve top countries

Retrieves the countries with the most searches to your index.

acl: ["analytics"]
query Parameters
endDate
string
Example: endDate=2023-01-21

End date of the period to analyze, in YYYY-MM-DD format.

index
required
string
Example: index=YourIndexName

Index name.

limit
integer
Default: 10

Number of items to return.

offset
integer >= 0
Default: 0

Position of the first item to return.

startDate
string
Example: startDate=2022-09-19

Start date of the period to analyze, in YYYY-MM-DD format.

tags
string
Example: tags=device:mobile%20phone

Tags by which to segment the analytics.

You can combine multiple tags with OR and AND. Tags must be URL-encoded. For more information, see Segment your analytics data.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetTopCountriesAsync("index");

Response samples

Content type
application/json
{
  • "countries": [
    ]
}

Status

Check the status of the Analytics API.

Retrieve update status

Retrieves the time when the Analytics data for the specified index was last updated.

The Analytics data is updated every 5 minutes.

acl: ["analytics"]
query Parameters
index
required
string
Example: index=YourIndexName

Index name.

Responses

Request samples

// Initialize the client
var client = new AnalyticsClient(
  new AnalyticsConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);

// Call the API
var response = await client.GetStatusAsync("index");

Response samples

Content type
application/json
{
  • "updatedAt": null
}