常看到代码http://www.google-analytics.com/urchin.js,这个JS是GOOGLE的analytics 分析代码
google analytics 的功能是非常强大的,强烈推荐使用网上找的:
//定义全局量
var ur = "";?????????????????????????????????? //来源地址
var urp = new Array();???????????????????????????? //来源参数名称
var urpv = new Array();???????????????????????????? //来源参数值
var arrayCount = 0;?????????????????????????????? //参数数目
pageOpen = new Date();?????????????????????????????? //进入页面的时间
var reqURL = "http://192.168.0.219/Analytics/";???????????? //接收数据的页面地址
var GUID = Math.round(Math.random()*2147483647);?????????? //用户唯一随机数
var title = document.title;???????????????????????? //网页标题
var uexp = pageOpen.getTime() + ( 1000 * 60 * 60 * 24 * 30 ); //设置cookie过期时间 既回访用户的限定
var rtu = "false";?????????????????????????????? //指示用户是否回访用户
//浏览器特征信息
var brower = new Array();
/**//*
* brower[0] 浏览器类型
* brower[1] 浏览器版本
* brower[2] 浏览器java是否打开 1开-1关
* brower[3] 浏览器flash版本
* brower[4] 浏览器操作系统
* brower[5] 浏览器分辨率
* brower[6] 浏览器色深
* brower[7] 浏览器语言
* brower[8] 浏览器插件
*/
var sEn=new Array();???? //搜索引擎的名称
var keyWord=new Array(); //关键字传输形式
sEn[0]="google";?????? keyWord[0]="q";
sEn[1]="yahoo";?????????? keyWord[1]="p";
sEn[2]="msn";?????????? keyWord[2]="q";
sEn[3]="aol";?????????? keyWord[3]="query";
sEn[4]="lycos";?????????? keyWord[4]="query";
sEn[5]="ask";?????????? keyWord[5]="q";
sEn[6]="altavista";?????? keyWord[6]="q";
sEn[7]="search";?????? keyWord[7]="q";
sEn[8]="netscape";?????? keyWord[8]="query";
sEn[9]="earthlink";?????? keyWord[9]="q";
sEn[10]="cnn";?????????? keyWord[10]="query";
sEn[11]="looksmart";???? keyWord[11]="key";
sEn[12]="about";?????? keyWord[12]="terms";
sEn[13]="excite";??"));}
??? for(var i = 0; i < sEn.length; i++)
??? {
????? if(hostname == sEn)
????? {
????????? for(var j = 0; j < urp.length; j ++)
????????? {
??????????? if(urp[j] == keyWord)
??????????? {
????????????? return urpv[j];
??????????? }
????????? }
????? }
??? }
??
??? return "";
}
//将URL转换为地址和页面参数和参数值 参数uri为页面地址
function gethn(uri)
{
??? if(!uri || uri == "") return "";
??? ur = uri;
??? var sub;
??? //带参数
??? if(ur.indexOf("?") != -1)
??? {
????? var url = ur.substring(0,ur.indexOf("?"));
????? var para = ur.substring(ur.indexOf("?")+1,ur.length);
????? while(para.length > 0)
????? {
????????? if(para.indexOf("&") == -1)
????????? {
??????????? urp[arrayCount] = para.substring(0,para.indexOf("="));
??????????? urpv[arrayCount] = para.substring(para.indexOf("=")+1,para.length);
??????????? break;
????????? }
????????? sub = para.substring(0,para.indexOf("&"));
????????? urp[arrayCount] = sub.substring(0,sub.indexOf("="));
????????? urpv[arrayCount] = sub.substring(sub.indexOf("=")+1,sub.length);
????????? para = para.substring(para.indexOf("&")+1,para.length);
????????? arrayCount ++;
????? }
????? return url;
??? }
??? else
????? return ur;
}
//----------------------------获得域名---------------------------------------------
function getHostName(url)
{
??? url = url.substring(url.indexOf('://')+3,url.length);
??? url = url.substring(0,url.indexOf("/"));
??? return url;
}
//---------------------------获得flash版本------------------------------------------
function getFlash() {
var f="-1",n=navigator;
if (n.plugins && n.plugins.length) {
for (var ii=0;ii<n.plugins.length;ii++) {
??? if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
??? f=n.plugins[ii].description.split('Shockwave Flash ')[1];
??? break;
??? }
}
} else if (window.ActiveXObject) {
for (var ii=10;ii&g