Guides / Getting analytics / Search analytics

Out-of-the-box analytics

Algolia’s out-of-the-box search analytics helps you model your users’ behavior by breaking down their searches into metrics such as popular searches, the number of searches with no results, and filter usage. It helps you make data-driven decisions when building and improving your search experience. Algolia automatically captures search analytics. There’s nothing you need to do, there’s no coding involved, and it doesn’t affect search speed. Algolia captures large amounts of search-related analytics in the background with every search.

Search analytics can help you plan how to structure your data and how to configure your ranking and relevance. It can also lead you to use more advanced API settings to improve your users’ search experience. For your organization, you can use analytics to see if:

  • Your data is adequately described
  • The correct records show up in search results
  • Your data is properly represented. For example, your search results might show too many of one product but need more of another.

What do search analytics measure?

  • Overall search counts
  • A “No search result” rate
  • Top searches
  • Top searches with no results
  • Top results
  • If a filter is provided, top searches associated with that filter
  • Top filter attributes and filter values
  • Distinct count of IP addresses / Users
  • Top countries

Here’s an example of what you can expect to measure:

Analytics dashboard view, drilling down on the search results for kilo

Which searches are captured?

Differences between queries and search terms in the analytics

There’s a difference between the number of queries executed in the search engine and the number of queries stored by the analytics engine. Your app usually runs more queries than the analytics engine stores.

Algolia’s search engine executes queries on each keystroke, but the analytics engine uses a different approach. To ensure relevant analytics data, it ignores initial keystrokes and keeps only the final query that the user types.

For example, if a user types in “beatles”:

  • The search engine performs seven queries: “b”, “be”, “bea”, “beat”, “beatl”, beatle”, and (finally) “beatles”.
  • The analytics engine only saves one query, the last one, “beatles”. It ignores: “b”, “be”, “bea”, “beat”, “beatl”, and “beatle”.

This behavior is called query aggregation.

The analytics engine aggregates the keystrokes and only stores the final search term. It does this based on factors such as edit distance, timestamp, and, most importantly, the user ID. If you don’t provide a userToken parameter, the user ID defaults to the IP address that performed the search.

More on query aggregation

When you perform searches from your backend, the IP address (user ID) is your server’s IP address. The engine will only correctly compute analytics metrics if you provide a unique ID for the user performing the search query aggregations.

You can provide a unique user ID in one of two ways:

  • Set the X-Algolia-UserToken header to forward a user ID, or use the userToken parameter. The analytics engine uses this token to perform query aggregation and compute the user count.
  • Set the X-Forwarded-For header to forward the user’s IP address. The analytics engine uses this IP as the userToken if you don’t provide one.

A user IP address is also required for geolocation to work.

Empty queries in the analytics

By default, InstantSearch shows results as soon as users land on a page (with InstantSearch). InstantSearch does this by performing a search with an empty query. Empty query searches appear in your dashboard as <empty search>.

Query normalization in the analytics

The engine normalizes queries (puts them in lowercase and removes diacritics) to simplify the analysis of your user’s behavior. For example, statistics for the query “Beatles” are grouped with “beatles” because they return the same results, just like “café” and “cafe”.

You can prevent this normalization with the keepDiacriticsOnCharacters setting.

Accessing analytics data

Search analytics appear about 10 minutes after they occur and can be accessed from the:

Did you find this page helpful?