{"id":350,"date":"2011-08-28T22:02:49","date_gmt":"2011-08-28T22:02:49","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=350"},"modified":"2011-08-28T22:02:49","modified_gmt":"2011-08-28T22:02:49","slug":"tracking-anonymous-user","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/tracking-anonymous-user\/","title":{"rendered":"Tracking anonymous users"},"content":{"rendered":"<p>Let&#39;s face it, having to create an account is probably the number 1 reason that users avoid doing anything trivial on the web. By trivial, I mean things like commenting on blog entries, posting content, playing online games, etc.<\/p>\n<p>It just so happens that these are generally the type of things that could most benefit from allowing anonymous interaction.<\/p>\n<p>The challenge is tracking users, so they can maintain at least a minimal account-like status. For instance, if a user anonymously submits a comment to a blog post, they may want to later edit that comment. But, there&#39;s no way to allow this without tracking the user in some way.<\/p>\n<p>The most obvious way to track a user is the session scope. Using the blog post comment as an example, this would allow a user to edit their comment as long as their session is alive.<\/p>\n<p>But, if they want to come back tomorrow and edit their comment, the session scope is out of the question.<\/p>\n<p>This is where cookies come into play. There are essentially two options with cookies:<\/p>\n<ol>\n<li>Identifying the user by their IP address, user agent, or other uniquely identifying factor<\/li>\n<li>Assigning a random identifier to a user<\/li>\n<\/ol>\n<p>Both options require that you store the identifier in a browser cookie.<\/p>\n<p>Option #1 is more flexible. If you encrypt the users IP address and store it in a browser cookie, as well as in your database table, you could later re-identify this user as the owner of a given object (a blog post comment, for example). However, it&#39;s quite simple to spoof an IP address or user agent, so all a malicious user would have to do is know another users IP address to gain full access to their content.<\/p>\n<p>Option #2 is safer. However, option #2 will only allow anonymous account access to one browser (as opposed to option #1 allowing access to any PC\/browser combo sharing the same IP address). With option #2, you simply assign a random identifier to a user, then store it in a browser cookie, as well as your database table.<\/p>\n<p>It would seem, that option #2 is a nice alternative to forcing a user to create an account.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#39;s face it, having to create an account is probably the number 1 reason that users avoid doing anything trivial on the web. By trivial,&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[15,41],"tags":[121,120],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/350"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":0,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}