If you build your own search user interface using the AddSearch Search API, the following data is sent to AddSearch Analytics backend automatically:
AddSearch JS client library provides a method to send search result clicks to analytics. Include the JS client library to your search results page’s HTML template:
<script src="https://cdn.jsdelivr.net/npm/addsearch-js-client/dist/addsearch-js-client.min.js"></script>
After you have added the script element, call the following JavaScript function to send clicks to the AddSearch Analytics Dashboard:
var client = new AddSearchClient('YOUR PUBLIC SITEKEY'); client.sendStatsEvent('click', keyword, {documentId: id, position: n});
sendStatsEvent function’s parameters are:
Recommended event listeners in result links, that fire the sendStatsEvent function, are:
For further documentation, see AddSearch API Client on Github.
The recommended way to create Search UIs is the AddSearch Search UI library which handles analytics events automatically.
When clicks are sent to analytics, the data is used to improve your search results by our self-learning algorithm.
We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.