Analytics API Dev

If you build your own search user interface using the AddSearch Search API, the following data is sent to AddSearch Analytics backend automatically:

  • Keywords used
  • Keywords not returning any results

We provide a JavaScript function to save the search clicks’ information. Add the following JavaScript to your search results page’s HTML template:

<script src="">

After you have added the script element, call the following JavaScript function to send the click to the AddSearch analytics server:

Function’s parameters are

  • sitekey: Your public sitekey. Get it from your Dashboard’s Installation page
  • keyword: Keyword used to do the search
  • clickedDocId: ID of the search result being clicked. You get the ID from Search API’s response JSON or calculate an MD5 hash of the document URL to create the ID by yourself
  • positionOfClickedDoc: Position of the result being clicked. The first result is 1, the second is 2 and so on. This is an optional parameter.

Self-learning algorithm

When the function is invoked, the data of results clicks is used to improve your search results by our self-learning algorithm.

Need more help?

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.