Getting count of number of times an item has been searched

Hi there, I am wondering if there is somewhere I can get the number of times an item has been “displayed” within a search?

I would like to start allowing users to pay to “promote” a listing (listings being indexed here at Algolia). The user would pay $X for # of guaranteed displays of their product (in a relevant search) at the top of a search.

With this in mind, is there a way I can count the number of times an item was searched (and found) via Algolia? Or is this something I would need to take care of in the backend of my DB? I’m using Firestore and the write operation to the DB (which would trigger Algolia index to update as well) would start costing more than the worth, I believe.

Any thoughts?

Hi @nathan.j.grealish,

On our Business and Enterprise plans, you have access to advanced analytics, and you can get the number of times a specific record was displayed in the search result using the Top Hits endpoint: https://www.algolia.com/doc/rest-api/analytics/#get-top-hits.

This will give you the number of times each of the top 1000 hits were displayed during the period you set, but you wont be able to search this information for a specific record outside of the 1000 most common hits.

If you do not have access to this API on you current plan, or if this is not exactly what you are trying to achieve, it might be best to keeping track of hits on your end and compute a total number of display in your own database.

If you store this information in your record in Algolia, each update would count as 1 operation, so this might indeed significantly increase your number of operations. However, if you do not use this information as a feedback loop to rank results, but only as a business metrics to charge your own customers, you might not need to store it in Algolia at all and keep it in you database instead.

I hope this helps! Let us know if you need more clarifications.

1 Like

Thank you for this information! I will take a look into the #get-top-hits in the analytics section. It does seem like I may need to figure out a good way to do this. I also need to change my function so it only updates Algolia on important changes, rather than this sort of update.

Again, thank you for the information!

1 Like