捕获用户活动的Javascript [英] Javascript capturing user activity

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

问题描述

是否存在用于捕获用户活动浏览器端的js库?

Is there an existing js lib for capturing user activity browser side?

即.滚动,鼠标移动,鼠标单击等 我一直在谷歌搜索,搜索stackoverflow和github,但我一直在获得指向付费分析程序的链接,而这些链接并不是我所追求的.

ie. Scrolling, mouse moving, mouse clicking etc. I've been googling, searching stackoverflow and github but I keep getting links to paid analytic programs which aren't quite what I'm after.

我很想自己开始构建某些东西,但是我对它的思考越多,我就越难意识到它的存在,如果有的话,最好使用一些现有的lib.

I'm tempted to start building something myself, but the more I think about it, the harder I realise it'll be and I'd be better off using some existing lib if available.

我在想什么.这是解决问题的合适方法吗?

What I'm thinking. Would this be an appropriate way to go about it?

  • 我假设最好的方法是侦听正文或窗口元素并捕获所有尚未禁用冒泡的所需事件.
  • 最好在发送/发布到服务器之前对数据进行批处理和最小化.如在删除模式或频繁出现的数据中.如果用户滚动,则不需要所有滚动事件,只需有意义的事件即可启动,加速或停止.
  • 可以每X个事件或X秒发出一批.并发送最后一批window.onbeforeunload.

我在此处找到了两个问题此处.但是我不怎么想.

I found these two questions here & here. But aren't quite what I'm after.

我希望能够配置事件聚合以询问有关用户交互的问题.诚然,我对Google Analytic(Google Analytic)的使用已经过时,也许我错了,但是乍一看自定义事件跟踪似乎不合适.记录特定的个人操作不是我想要的.

I want to be able to configure the event aggregation to ask a question on user interaction. Admittedly I'm out of date with Google Analytic, and maybe I'm wrong, but at a glance custom event tracking doesn't seem to fit the bill. Logging specific individual actions isn't what I'm after.

推荐答案

您必须自己编写(或者至少是我做的).

You must write it yourself ( or at least that's what i did ).

备份问题:是否有任何JavaScript库可捕获鼠标/键盘事件并将其发送到外部服务器?

这是一个有效的jsfiddle: http://jsfiddle.net/94dd343y/

Here is a working jsfiddle: http://jsfiddle.net/94dd343y/

        $(document).ready(function(){
        $('html').mousemove(function(event){
            console.log("mouse move X:"+event.pageX+" Y:"+event.pageY);
        });

        $('html').click(function(event){
            console.log("mouse click X:"+event.pageX+" Y:"+event.pageY);
        });

        $('html').keyup(function(event){
            console.log("keyboard event: key pressed "+event.keyCode);
        });
    });

以此类推.

如果要捕获所有事件,请参见以下列表:

If you want to capture all the events, here is a list:

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