跟踪用户的每个活动。 [英] Track each and every activity of user.

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

问题描述

I want to track all activity of registered user (user already created a account in web application) on a webpage like where he clicked (not a postback event used onclick of anchor), what text he searched (like filter of records etc), how much time spend on a webpage without using any third party tool (try to do this in JavaScript, JQuery, .net using c#). 





我的尝试:



我试图创建一个服务,它调用所有页面的page_load事件,或者可能在master中但无法进行客户端事件。



What I have tried:

I tried to create a service which called on a page_load event of all pages or may be in master but unable to do clients side events.

推荐答案

是的,你可以不是用C#代码做的。 ASP.NET代码完全在服务器端运行。根本无法访问客户端。



如果您正在寻找用户点击的页面上的内容,您必须使用客户端脚本来这样做,然后发送你想要的任何日志记录服务器的信息。
Yeah, you can't do this from C# code. ASP.NET code runs ENTIRELY server-side. It has absolutely no access to the client at all.

If you're looking for stuff like where on the page a user clicked you MUST use client-side scripting to do it and send that information however you want to whatever logging server you write.


正如Dave所说,你必须使用JavaScript。从理论上讲,当您的页面加载时,您可以挂钩所有相关标签并为每个标签添加一个事件监听器(提示JavaScript提供了您需要使用的addEventListener)。这种方法有限制,取决于你如何勾选它;主要是你可能会发现addEventListener监听冒泡的事件(例如,如果你把它添加到文档中来监听点击事件),所以如果某些事情导致事件没有冒泡,那么你就不会抓住它。
As Dave said, you would have to use JavaScript. Theoretically, when your page has loaded you could hook into all the relevant tags and add an event listener to each one (hint JavaScript provides an addEventListener that you would need to use). There are restrictions with this approach though, depending how you hook it up; primarily that you may find that addEventListener listens for events bubbling up (e.g., if you added it to the document to listen for click events), so if something causes the event not to bubble then you won't catch it.


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

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