开发者

How do I track users of my app without forcing them to register?

开发者 https://www.devze.com 2023-01-23 19:43 出处:网络
What is the most common strategy for tracking users with cookies without forcing them to register? Do I create a guest account, assign a GUID, and then put that GUID value in their cookie? Is there

What is the most common strategy for tracking users with cookies without forcing them to register?

Do I create a guest account, assign a GUID, and then put that GUID value in their cookie? Is there a more generally accepted method of doing this?

Although this is a general web app question, I开发者_运维技巧'm using ASP.NET MVC.


One popular solution, as you write, is to send the GUID to the user inside a cookie. Obviusly this solution work only if the user has cookies enabled.

Please note that the contents of cookies is perfectly readable by the user who receives it.

Also the session is a good place to store temporary data. Its duration depends on the configuration of your site and if desired, with a little 'work, it is extremely durable and can have a low impact on server memory (sessions in the db)


A guid in a cookie is one way of doing it.

If the user didn't have cookies enabled, I suppose you could do it another way which which involves creating small hashes (like bit.ly, j.mp et al) and inserting them into the url. All your routes would be populated with this hash (either created at the start of the request, or taken from the url if they already have one).

It's not exactly the cleanest of methods, but it gets around situations where the user doesn't have a cookie enabled and inserts a very small string into the url.

For example http://example.com/fG3Er/Home/Index or http://example.com/Home/Index?guestId=fG3Er where fG3Er is the unique guest id.

Alternatively, you could just append it on to the end of each url as a querystring.

Either way, I definitely favour the guid-based approach, and if the user doesn't want to use cookies on your site, you can always explain to them that their experience will be impaired. You could always find out what proportion of your users disable cookies by creating a test one, and comparing that against the number of actual hits (unless Analytics has a way of determining cookies being enabled - not sure).

0

精彩评论

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

关注公众号