How to identify revisiting users without login info

二次信任 提交于 2019-12-06 02:07:17
Davide Aversa

Setting cookies is very easy. In my experience the simplest way to set them is through a JQuery plugin: jquery-cookie.

For your task you can set a cookie with a random almost-unique ID (check this question to know how) the first time the user open your website. For example

$.cookie('user_id', 'the_random_id');

When the user come back you can read that value

user_id = $.cookie('user_id')

and check in your database the relative information about that user.

Obviously if an user does not accept cookies or deletes them you cannot identify him.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!