Hello,
I would like some advice on how to proceed with our new feature.
We need to track events performed by our users, some of them related to search and others not. The counters should cover all our ObjectIDs, since we want to show it to the respective users.
These events are similar to the ones expected in Insights API:
- count times an ObjectID appeared searches.
- count times an ObjectID was clicked (before or after search).
- count times an ObjectID was converted (before or after search).
- count times an ObjectID was added as favorite.
It would be very helpful if we could retrieve this information from the Insights API. I have searched the documentation, but it seems Insights API only allows the events to be sent, but not retrieved, is this correct ?
The Analytics API seems to be a way to retrieve this info, but it is limited to the first 1000 most popular ObjectIDs (in top hits method for ex.). I wonder how tag filters affect this limit, for ex. could I retrieve a thousand most popular hits with ‘device: desktop’ and another (different) thousand for ‘device: mobile’ ?
The last option I thought of is to create a new Index to gather these events. This Index would grow with time, and we would have to implement our own time period filters.
Could you give us an advice on the best way to approach this ?
Thank you !
Hi Gustavo, The Analytics API feels like the right approach here, although you’re correct this is capped at the top 1000 resources. Algolia isn’t really set up to be the source of truth for users activity reporting, although we’ve been exploring moving that direction. It might make sense to layer in a dedicate analytics tool like Google Tag Manager or Segment and then push that data to Algolia as well.
I’m not sure of your motivation/use-case, but rather than surface the data directly to the end user, it might make more sense to use the data to train models (like Recommend’s Frequently Bought Together or Trending Items) to guide them rather than giving them the data directly.
Hello, Chuck, thank you for your reply.
In our use case, our clients publish profiles, those are the objects persisted in our Algolia Index. We would like to show our users (the profiles owners) how they perform in searches, views and clicks. We need to provide this info to all users, that’s why the Analytics API wouldn’t work, unfortunately .
It would be useful if we could query the Insight Events submitted in the last 6 months, for ex. Then we could query those in order to get the counters.
I’m considering using a new Index to persist the events, I would insert them using the JS API at the same time they are submitted to Insights API. Do you see any issue with this approach ?
Sorry for the delay – I was on vacation last week.
My concerns with your approach are size of the index and the frequency of updates. Algolia is not really optimized for event streams like this and it may overtax your index depending on the frequency of record adds.
This is a really interesting use case – is it ok if I pass it along to the product manager for Events? They may have some more insights (pun intended).
Hello, Chuck,
no worries, hope you had a nice rest =)
The index would be updated every time a user does a search. And we would keep 1 year history of events in the index.
The event object would have structure like this:
{
"objectID": "123456",
"category": "search",
"created_at": 1674745900,
"data": {
"search_id": 10,
"personal_profile_ids": [1000, 1001, 1002, 1003, ...]
}
}
and we would query it like this
index.search('', {
hitsPerPage: 0,
filters: `category:'search' personal_profile_ids = 1000 AND created_at >= 1674745900`
}).then( ({ nbHits }) => setCounterValue(nbHits) )
I had not thought about overpricing, thanks for bringing that into attention.
It would be great if you could help us finding a solution for this.
Would you like our Product Manager to contact you for more insights (lol) ? I can definitely arrange that.
Hey @keshia.rose – this is the use case I was discussing with you.
Hello, @chuck.meyer and @keshia.rose
After Chuck has pointed out the overpricing issue I went to check our current month’s usage and I found out it’s VERY high.
We did some tests in our QA environment, but nothing has been deployed to production, thus, I believe this high value is simply due to the amount of records we added to the index in our tests.
Considering this means almost no resources were used from Algolia servers (very few searches), I wonder if you could refund this excess, or at least part of it.
Thank you for you consideration