[英]Visit Tracking - server-side / client-side
I have an asp.net (webforms) application and I would like to track user visits to the site. 我有一个asp.net(网络表单)应用程序,我想跟踪用户对该站点的访问。 I have the DB, objects, basic idea down.
我把数据库,对象,基本思想都弄下来了。
My goal is to track a user from the first time he enters the site and up until he creates an account. 我的目标是跟踪用户,从他第一次进入网站开始直至创建帐户。 So I can trace back where this user came from in his initial visit (Organic, paid, referrer, etc.).
因此,我可以追溯到该用户在初次访问时来自何处(有机,付费,推荐人等)。
I am planning to create a cookie with a GUID for each initial visit, store all actions in the DB, and finally, when the user registers, I can go back and update a username field for all rows matching the GUID. 我打算为每次初次访问创建一个带有GUID的cookie,将所有操作存储在数据库中,最后,当用户注册时,我可以返回并更新与GUID匹配的所有行的用户名字段。
My problem is that I can't make up my mind on the best method to do this. 我的问题是我无法下定决心做到这一点的最佳方法。 Should I use an HTTP module and the session start and end events, or maybe ajax calls to a WCF backend?
我应该使用HTTP模块以及会话的开始和结束事件,还是对WCF后端进行ajax调用?
What would be the most efficient and accurate way to do this? 什么是最有效,最准确的方法?
Unless you plan on supporting anonymous sessions (which depending on traffic may or may not be an option), Session won't work. 除非您计划支持匿名会话(可能会或可能不会选择匿名会话),否则会话将无法工作。
The simplest thing that could work is simply putting a ticket (like your guid) in a cookie. 可行的最简单的方法就是将一张票(如您的GUID)放入cookie。 You can set and retrieve Cookies from your Page and use that to track the user.
您可以从页面设置和检索Cookies,并使用它来跟踪用户。 This does mean you'll only be able to track a user when he accesses from the same machine but until he's authenticated, you don't really have that much of a choice.
这确实意味着,只有当用户从同一台计算机访问时,您才能跟踪该用户,但是直到该用户通过身份验证为止,您实际上没有太多选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.