Hi all. I have a question related to analytics cl...
# community-help
d
Hi all. I have a question related to analytics click events. I have a collections that I want to update, but before anything, I wanted to test this out. I used the documentation to create a
products
table with a
popularity
field, but no specific id field, so Typesense created it for me. I created 3 documents but deleted 1,3, and then created #4, leaving on 2,4 as documents. I created a simple
products_click_event
rule to update the popularity field, where the source and destination were both products and then using curl, fired the event to update #2. The response was "ok", but the popularity wasn't changed. Looking at the example in the documentation, on a whim, I fired the event for doc_id 1124 and it updated product 2, and 1125 updated product 4. This didn't make sense to me. I deleted the rule, recreated it, and fired for doc_id 2 and now it worked. I updated my
stories
collection to have a
popularity
field, created the rule
stories_click_event
and then fired the event for one of my documents, using its document id. Similar to the products example, the response was "ok", but the popularity wasn't changed. I deleted and recreated the rule, but same "no change". One thing to note is that the
id
field on
stories
is being created in a custom way, instead of Typesense managing it. Regardless, I'm not sure where to go with this, or why products_click_event worked after I deleted/recreated the rule, but not the first time, or why the stories_click_event doesn't work at all. Any and all help is appreciated!
f
The field will not be updated as soon as the click events comes through, there's a flush interval that needs to take place first. So that may be why you faced that behavior. Do click events go through now and update the documents?
d
Hi Fanis, thanks for responding. I did change the flush interval to 10, which I believe is 10 seconds, but that hasn't made any difference as I have waited long enough for the flush event to have happened.
--analytics-flush-interval=10
f
Do click events still go through without the analytics rule being in place?
d
no, it says the event doesn't exist
f
Are you on typesense cloud or self-hosting?
d
local instance for development
f
Can you post a quick set of curl commands that replicate the behavior like here? https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b It's hard for us to debug without having a reproducible environment of this
d
Yes I will do that. I very much appreciate your help. I honestly didn't expect such a quick response, and I had to stop working on this, but I will do it as soon as I can
🙌 1
Thanks again Fanis! It turns out that a customization of our backend was causing the issue. It has been resolved for now.