docs-site/content/guide/search-analytics.md
A common need when building search experiences is to get answers to questions like:
In order to answer most of these questions, you need not just search data, but also data about how a user engages with different parts of your site or app. This is data you are most likely already capturing in your web/app analytics tool of choice like Amplitude, Google Analytics, Heap, Mixpanel, Plausible, Pendo etc.
Given that you need the context of user-behavioral data to get a complete picture of how your search experience is performing, we highly recommend instrumenting your search experience on the client-side, to send additional search data along with the rest of the data you are already capturing, to your existing analytics platform.
As of v0.25.0, Typesense supports the ability to capture <RouterLink :to="`/${$site.themeConfig.typesenseLatestVersion}/api/analytics-query-suggestions.html`">Search Analytics</RouterLink> (the top searched terms) natively. Once the search terms are collected, you can then sort by the count of each search term to get the top search terms.
If you are using the InstantSearch UI Library, it comes with out-of-the-box widgets to help you capture search data, and send it to your analytics tool of choice on the client-side:
See the Linux Commit Search reference implementation for an example of how to implement this in code.
You'd typically want to listen to changes to your search field (with a debounce of say 1s), then capture the search term and search results displayed, and make an API call to your analytics platform using their API library, indicating that a search event has occurred.