- 3
Need Help
Anyone can give the rules or code for collect and gather reaction/comments from visitor my website, like give a thumb/like/star/ or anything without login as anonymous to know how many people react my website
1 Réponse
+ 1
You will obviously need a database.
For the anonymity part, this is what you do.
1. When the user sends the first reaction to the backend, the client will send a request with the reaction and an empty "id" (a JSON payload).
2. The server receives the requests and creates a new user id in the database. Then adds the reaction to a reaction table in the database, with association to the anonymous user and the post that was reacted on.
3. Server returns a list of reactions added my the user.
The client stores the user id in local storage (preferably in a httponly cookie, but that's an improvement thing).
Following requests are sent with the anonymous user id.