What is @algolia/client-analytics?
The @algolia/client-analytics package is designed to interact with Algolia's Analytics API, enabling developers to track and analyze search behavior and performance within their applications. It provides a comprehensive set of features for fetching analytics data, such as popular searches, no-result searches, and search counts, allowing for a deeper understanding of user interaction and search effectiveness.
What are @algolia/client-analytics's main functionalities?
Get Popular Searches
This feature allows you to retrieve the most popular searches made in a specific index. It's useful for understanding what users are most frequently looking for.
{"client.initAnalytics().getTopSearches({ index: 'your_index_name', size: 10 }).then((result) => { console.log(result); });"}
Get Searches with No Results
This functionality enables you to fetch searches that returned no results, which can be critical for identifying gaps in your content or areas where the search experience can be improved.
{"client.initAnalytics().getNoResultsRate({ index: 'your_index_name', size: 10 }).then((result) => { console.log(result); });"}
Get Search Count
This feature provides the total number of searches performed in a given index over a specified period. It's useful for tracking the overall usage and engagement with the search functionality.
{"client.initAnalytics().getSearchCount({ index: 'your_index_name' }).then((result) => { console.log(result); });"}
Other packages similar to @algolia/client-analytics
elasticlunr
Elasticlunr is a lightweight search engine providing similar search capabilities to Algolia but is designed for smaller scale applications. Unlike @algolia/client-analytics, it focuses more on the search engine itself rather than analytics.
search-insights
The search-insights package is another Algolia product that enables capturing search analytics data. It complements @algolia/client-analytics by providing a more event-centric view of user interactions, such as click and conversion tracking.
The perfect starting point to integrate Algolia within your JavaScript project
Documentation •
InstantSearch •
Community Forum •
Stack Overflow •
Report a bug •
FAQ •
Support
✨ Features
- Thin & minimal low-level HTTP client to interact with Algolia's API
- Works both on the browser and node.js
- UMD and ESM compatible, you can use it with any module loader
- Built with TypeScript
💡 Getting Started
[!TIP]
This API client is already a dependency of the algoliasearch client, you don't need to manually install @algolia/client-analytics
if you already have algoliasearch
installed.
To get started, you first need to install @algolia/client-analytics (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
With a package manager
yarn add @algolia/client-analytics@5.15.0
npm install @algolia/client-analytics@5.15.0
pnpm add @algolia/client-analytics@5.15.0
Without a package manager
Add the following JavaScript snippet to the of your website:
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-analytics@5.15.0/dist/builds/browser.umd.js"></script>
Usage
You can now import the Algolia API client in your project and play with it.
import { analyticsClient } from '@algolia/client-analytics';
const client = analyticsClient('YOUR_APP_ID', 'YOUR_API_KEY');
For full documentation, visit the Algolia JavaScript API Client.
❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the client. You can also open a GitHub issue
📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the MIT license.