欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js統(tǒng)計網頁在線時間的腳本

 更新時間:2008年04月24日 19:35:57   作者:  
分析用戶行為時,某網頁停留時間可能會是個可參考的數(shù)據(jù) 由后臺分析函數(shù)取一個合理值作為在線時間
每xxxxx毫秒檢測一次是否在線,
TR_COUNT次之后設定改用戶為假死狀態(tài)(即不在當前頁面活動,afk..)
當頁面關閉時把停留時間送出,

/**//* ----------------------------------------------------------------------------
* Script Name: online.js
* Last Modified: 2008-4-13 22:25
* Author: meyu
* Copyright (c) 2008
* Purpose: 跟蹤在線時間
* ----------------------------------------------------------------------------*/

function TR_XMLHttpObject(url)...{
    this.XMLHttp=null;
    this.url=url;
    this.init=function()...{
        if(window.XMLHttpRequest)...{
            this.XMLHttp=new XMLHttpRequest();
        }else if(window.ActiveXObject)...{
            this.XMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    };
    this.init();
    this.sendData=function(param)...{
        with(this.XMLHttp)...{
            open('GET',this.url+(param||''),true);
            send(null);
        }
    };
}
if(/flag=flush/i.test(window.location.search))...{
    var TR_COUNT=0;
    var TR_x=new TR_XMLHttpObject(window.location.href.replace(/&?(?:flush_count=)(d+)/i,
        function(a,d)...{
            TR_COUNT=parseInt(d);
            return "";
            })
    );
    function send()...{
        TR_COUNT++;
        if(TR_COUNT < 120)...{
            TR_x.sendData('&flush_count='+TR_COUNT);
        }
    }
    window.setInterval(send,30000);
    window.onunload=function()...{TR_x.sendData('&flush_count='+TR_COUNT);};
}

相關文章

最新評論