开发者

Django tracking anonymous users

I am building a system which serves content on external properties. I would like to track users which have not registered with my site with anonymous unique IDs. Then, if later they register with my site, I can covert them to regular Django users, but still have information related to their preferences and activities when they were anonymous.

Is there a facility to automatically set a user cookie via D开发者_JS百科jango so that if they user is accepting cookies, I have a user session ID to work with?

I'd prefer not to come up with a custom solution if Django has some path to move from Anonymous to Authenticated users.


I suggest you look for sessions. They use cookies, store a unique id into a cookie which is linked to a file on your server containing their data.

https://docs.djangoproject.com/en/dev/topics/http/sessions/


I've looked for a solution to problems like this in the past. Django Lazy Signup (https://github.com/danfairs/django-lazysignup) looks like it should solve your problem and not force you to reinvent the wheel, though, fair warning I haven't personally used the project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜