I am currently reading your Analytics & Query ...
# community-help
s
I am currently reading your Analytics & Query Suggestions article and I am having question about can we store search inputs as an id to make them unique and then can we pass input as doc_id in click event to increment popularity of input to show it when as an suggestion for the first time when user starts search
Copy code
curl "<http://localhost:8108/analytics/events>" -X POST \
     -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ 
     -d '{
            "type": "click",
            "name": "products_click_event",
            "data": {
                  "doc_id": "How to take screenshot",
                  "user_id": "fake_id"
            }
        }'
j
CC: @Krunal Gandhi
k
@Serezha Grigoryan Yes you can do that way. Alternatively if you want popularity of input then you can try popular queries too via existing query suggestion functionality.
s
Ok thank you for help
Can we use query suggestion functionality to show suggestion for new user when user just open search vidget and there is no input
Like can we send empty string ordered by score or count and get good suggestions
k
If you use popular queries feature that aggregates all popular queries by count in a collection. For a new user you can query that collection, sort desc by count and show top few popular queries as suggestions.
Popular queries is the best solution for your use case instead of using events api. We will do the aggregation on our end as searches happen automatically.
s
Thank you it's very informative