跟踪匿名用户活动 [英] Tracking anonymous user activity

查看:116
本文介绍了跟踪匿名用户活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要跟踪启用了Cookie的匿名用户.

I need to track anonymous users with enabled cookies.

基本上,他们会浏览该网站并与之互动,我希望为他们提供最佳体验,而无需实际注册.以后,如果他们愿意,他们可以注册,并且他们的网站活动将与他们的新帐户绑定.

Basically, they will go through the site, interact with it, and I would like to give them the best possible experience without requiring actual registration. Later on, if they want, they can register and their site activity will be tied to their new account.

类似Stackoverflow的东西,但我希望大多数用户不会实际注册,只是偶尔会卷土重来.

Something like Stackoverflow but with the difference that I expect that majority of my users won't actually register but occasionally just comeback.

因此,我不想在Users表中创建一堆虚拟记录.而且由于我只需要一张桌子,所以我在想这样的事情:

So, I don't want to create a bunch of dummy records in the Users table. And since I need it just for one table, I was thinking about something like this:

VoteHistory表

Id    TrackingToken    VotingData
1     100             ...
2     100             ...
3     101             ...
4     102             ...

用户表

Id    TrackingToken    OtherUsersColumns
1     100             ...

TrackingTokens表

LastTrackingToken
102

我将增加LastTrackingToken整数字段,然后将该值简单地添加到用户cookie中,并以此跟踪他的投票活动.然后,如果他决定注册,我只需将他的cookie TrackingToken值添加到他的用户"记录中即可.

I would increment a LastTrackingToken integer field and simply add that value to the users cookie and track his voting activity with it. Then, if he decides to register, I would simply add his cookie TrackingToken value to his Users record.

最初,我在考虑一个Guid/uniqueidentifier,但是由于投票表非常大并且需要查询它,因此我担心对uniqueidentifier字段建立索引.

Initially I was thinking about a Guid/uniqueidentifier but since the voting table will be very large and I will need to query it, I'm worried about indexing the uniqueidentifier field.

所以,这些问题是(很抱歉,有3个子问题,但它们是如此相关,我认为上下文很重要,所以我不想重复该问题和上下文描述):

So, the questions are (sorry for 3 sub-questions, but they are so related and I think the context is important, so I don't want to duplicate the question and context description):

  1. 在性能和索引方面,整数字段是否更好?请记住,TrackingToken不是主键字段!

  1. Is integer field better when it comes to performance and indexing? Have in mind that TrackingToken is not a primary key field!

您是否有其他想法可以完成我概述的方案?

Do you have some other idea how I could accomplish the scenario I outlined?

如果我决定手动生成整数TrackingToken,那么可靠地生成/增加新的TrackingToken的最佳方法是什么?假设很多并发用户将访问数据库.

If I decide to go with the manual generation of integer TrackingTokens, what would be the best way to reliably generate/increment a new TrackingToken? Assume a lot of concurrent users will hit the database.

推荐答案

在这个多重问题中回答您的第二个问题(您是否还有其他想法,我将如何完成我概述的方案),请查看以下内容:

To answer the 2nd of your questions in this multi-question (Do you have some other idea how I could accomplish the scenario I outlined), please see these:

使用ASP.NET + Cookie进行匿名个性化的有效方法

如何在我的应用程序中支持匿名用户?

所有内容都与ASP.NET中的匿名配置文件有关.

All pertain to anonymous profiles in ASP.NET.

这篇关于跟踪匿名用户活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆