百度分析js
(function(){ var c = { siteid:"84ed2e6f46b9d9bfdc018744dc663e07", domain:["testbaidustat.blogbus.com"], listener:[], _js_path:"tongji.baidu.com/hm-web/js/", icon:'http://eiv.baidu.com/hmt/icon/11|swf|20|20', bridge:false, hour:1800000, _curh:0, year:31536000000, sindex : [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], sengin : ["baidu.com", "baidu.com", "google.com", "google.cn", "sogou.com", "zhongsou.com", "search.yahoo.com", "one.cn.yahoo.com", "soso.com", "114search.118114.cn", "search.live.com", "youdao.com", "gougou.com", "bing.com"], sword : ["word", "wd", "q", "q", "query", "w", "p", "p", "w", "kw", "q", "q", "search", "q"], version:"1.0 0",iconLink:"http://tongji.baidu.com/hm-web/welcome/ico",clickTracker:false,documentWidth:null,apiName:"",rcv:"hm.baidu.com/hm.gif",_allowdomain:"baidu.com",_hmmd:"hmmd",_hmpl:"hmpl",_hmkw:"hmkw",_hmci:"hmci",_hmsr:"hmsr",_n:(new Date).getTime(),_isload:0,_t:["cc","cf","ci","ck","cl","cm","cp","cw","ds","ep","et","fl","ja","ln","lo","lt","nv","rnd","si","st","su","sw","se"]};var a=document;var g=a.location;var i=encodeURIComponent;var d=a.referrer;function f(l,k,j){k=k.replace(/^on/i,"").toLowerCase();if(l.attachEvent){l.attachEvent("on"+k,function(m){j.call(l,m)})}else{if(l.addEventListener){l.addEventListener(k,j,false)}}}function h(j){return a.getElementById(j)||null}function e(){this.tags={};this.getTracker()}e.prototype={getValue:function(l,m){var k=new RegExp("(^|&|\\?)"+l+"=([^&]*)(&|\x24|#)");var j=m.match(k);return j?j[2]:""},swf:function(o,k,j,l,n){var m='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+j+'" height="'+l+'" id="'+o+'" align="middle">';m+='<param name="allowscriptaccess" value="always">';m+='<param name="quality" value="high">';m+='<param name="movie" value="'+k+'">';m+='<param name="flashvars" value="'+n+'">';m+='<embed src="'+k+'" flashvars="'+n+'" quality="high" width="'+j+'" height="'+l+'" name="'+o+'" align="middle" allowscriptaccess="always" wmode="window" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';m+="</object>";return m},setCookie:function(k,l,o,n,j){var m=new Date();m.setTime(m.getTime()+j);a.cookie=k+"="+l+((j==null)?"":"; expires="+m.toGMTString())+"; domain="+o+(n?"; path="+n:"")},getCookie:function(k){var l=new RegExp("(^| )"+k+"=([^;]*)(;|\x24)");var j=l.exec(a.cookie);if(j){return j[2]||""}return""},getDs:function(){this.tags.ds=(window.screen.width+"x"+window.screen.height)},getCl:function(){this.tags.cl=(window.screen?window.screen.colorDepth+"-bit":"")},getCk:function(){this.tags.ck=(navigator.cookieEnabled?"1":"0")},getFl:function(){var p=navigator;if(navigator.plugins&&navigator.mimeTypes.length){var j=navigator.plugins["Shockwave Flash"];if(j&&j.description){this.tags.fl=parseInt(j.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s)+r/,"."))+".0"}}else{if(window.ActiveXObject){var l=0;for(var k=10;k>=2;k--){try{var o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+k);if(o){l=k+".0";break}}catch(m){}}this.tags.fl=parseInt(l)+".0"}}},getJa:function(){this.tags.ja=(navigator.javaEnabled()?"1":"0")},getLn:function(){var j;var k=navigator;if(k.systemLanguage){j=k.systemLanguage}else{if(k.browserLanguage){j=k.browserLanguage}else{if(k.language){j=k.language}else{if(k.userLanguage){j=k.userLanguage}else{j="-"}}}}this.tags.ln=j.toLowerCase()},getSi:function(){this.tags.si=this.siteid},getSu:function(){var j=d;this.tags.su=j?j:""},samDom:function(s,v){if(v.constructor==String){var t=s.indexOf(v);return(t>=0&&t<=8)?true:false}else{var k=v.length;for(var p=0;p<k;p++){var o=v[p];var l=o.length;var q=s.indexOf(o);var r=(q>=0&&(q+l)==s.length);if(r){return o}}}return s},samDir:function(q,p){if(p.constructor==String){var j=q.indexOf(p);return(j>=0&&j<=8)?true:false}else{var r=p.length;for(var o=0;o<r;o++){var m=p[o];var l=m.indexOf("/");if(l>-1){var j=q.indexOf(m);var k=(j>=0&&j<=8);if(k){return m}}}return false}},isRight:function(){var m=this.domain;var o=m.length;for(var l=0;l<o;l++){var k=m[l];var j=k.indexOf("/");if(j>-1){if(this.samDir(g.href,k)){return true}}else{if(this.samDom(g.hostname,k)){return true}}}return false},getDom:function(){return this.samDom(g.hostname,this.domain)},getPath:function(){var j=this.samDir(g.href,this.domain);if(j){return j.replace(/^(http:\/\/)?[^\/]+(\/.*)/,"$2")+"/"}else{return"/"}},getSt:function(){var w=null;var j=d;if(!j){if((c._n-c._curh)>this.hour){this.tags.st="1";return}else{this.tags.st="4";return}}else{var v=this.sengin;var s=this.sword;var p=this.sindex;for(var m=0;m<v.length;m++){if((j.indexOf(v[m])>-1)&&(this.getValue(s[m],j))){this.tags.sw=this.getValue(s[m],j);this.tags.se=p[m];this.tags.st="2";return}}}var q=false;if(this.isRight()){var u=this.domain;var l=u.length;for(var m=0;m<l;m++){var k=u[m];var o=k.indexOf("/");if(o>-1){if(this.samDir(j,k)){q=true}}else{if(this.samDom(j.replace(/^(http|https):\/\//i,"").split("/")[0],k)){q=true}}}}else{q=this.samDir(j,g.hostname)}if(q){if((c._n-c._curh)>this.hour){this.tags.st="1";return}this.tags.st="4";return}this.tags.st="3"},getCmpwi:function(){var j=g.href;this.tags.cm=this.getValue(c._hmmd,j)||"";this.tags.cp=this.getValue(c._hmpl,j)||"";this.tags.cw=this.getValue(c._hmkw,j)||"";this.tags.ci=this.getValue(c._hmci,j)||"";this.tags.cf=this.getValue(c._hmsr,j)||""},getNvLt:function(){var k="";c._curh=this.getCookie("Hm_lpvt_"+this.siteid)||0;this.getSt();if(this.tags.st!="4"||!c._curh){k+=1}else{k+=0}this.setCookie("Hm_lpvt_"+this.siteid,c._n,this.getDom(),this.getPath());var l="";var j=this.getCookie("Hm_lvt_"+this.siteid);if(k=="1"){this.setCookie("Hm_lvt_"+this.siteid,c._n,this.getDom(),this.getPath(),this.year)}var m=(this.getCookie("Hm_lpvt_"+this.siteid)==c._n)?"1":"0";this.tags.cc=m;this.tags.lt=(j?Math.round((j-0)/1000):"");this.tags.nv=k},getRnd:function(){var j=Math.round(Math.random()*2147483647);this.tags.rnd=j},getTop:function(){this.tags.lo=((typeof(_bdhm_top)=="number")?"1":"0")},JTQ:function(l){var r=[];var p=c._t;for(var q=0,t=p.length;q<t;q++){var o=p[q],m;var k=l[o];switch(o){case"se":m=k?o+"="+i(k):false;if(m){r.push(m)}break;case"sw":m=k?o+"="+i(k):false;if(m){r.push(m)}break;default:m=l[o]?o+"="+i(l[o]):o+"=";r.push(m)}}return r.join("&")},getPar:function(){this.getNvLt();this.getCmpwi();this.getSu();this.getSi();this.getLn();this.getJa();this.getFl();this.getCk();this.getCl();this.getDs();this.getTop();this.tags.et="0";this.tags.ep=""},protocol:function(){return(g.protocol=="https:"?"https://":"http://")},init:function(){try{this.getPar();this.postData();this.addLocLis();this.addIcon();this.addEvtLis();this.adDocEvt();this.initBridge()}catch(l){var j=[];j.push("si="+this.siteid);j.push("m="+i(l.message));j.push("n="+i(l.name));var k=new Image(1,1);k.src=this.protocol()+this.rcv+"?"+j.join("&")}},initBridge:function(){if(this.bridge){var k=this.getH(this.siteid);var j=k%1000;a.write(unescape("%3Cscript charset='utf-8' src='http://qiao.baidu.com/site/"+j+"/"+this.siteid+"/b.js' type='text/javascript'%3E%3C/script%3E"))}},getH:function(n){var l=5381;var m=n.length;for(var k=0;k<m;k++){var j=new Number(n.charCodeAt(k));l=(l*33+j)%4294967296}if(l>2147483648){l=l-2147483648}return l},adDocEvt:function(){if(this.clickTracker){f(a,"mouseup",this.getPos())}f(a,"click",this.evHandle())},evHandle:function(){var j=this;return function(p){var p=p||window.event;var u=p.clientX+":"+p.clientY;var q=p.srcElement||p.target;var t=q.getAttribute("HM_fix");if(t&&(t==u)){q.removeAttribute("HM_fix");return}else{var k=j.listener.length;if(k>0){var l={};var r=q;while(r&&r!=a.body){if(r.id){l[r.id]=""}r=r.parentNode}for(var m=0;m<k;m++){var o=j.listener[m];if(l.hasOwnProperty(o.id)){j.tags.et="1";j.tags.ep="{id:"+o.id+",eventType:"+p.type+"}";j.postData()}}}}}},ie:function(){var j=/msie (\d+\.\d)/i.test(navigator.userAgent);return j},getPos:function(){var j=this;return function(p){var p=p||window.event;var s,q,o,n,k,l;k=Math.max(a.documentElement.scrollTop,a.body.scrollTop);l=Math.max(a.documentElement.scrollLeft,a.body.scrollLeft);if(j.ie()){s=p.clientX+l;q=p.clientY+k}else{s=p.pageX;q=p.pageY}if(j.documentWidth){var t=Math.max(a.documentElement.clientWidth,a.body.clientWidth);o=(t-j.documentWidth)/2;n=0}else{o=0;n=0}function m(v,u){return{x:v-o,y:u-n}}var r=m(s,q);s=Math.round(r.x/10)*10;q=Math.round(r.y/10)*10;j.tags.et="2";j.tags.ep=s+"x"+q;j.postData()}},postData:function(){this.getRnd();var j=new Image(1,1);j.onload=function(){c._isload=1};j.src=this.protocol()+this.rcv+"?"+this.JTQ(this.tags)},addIcon:function(){if(this.icon!=""){var j;var k=this.icon.split("|");var m=this.iconLink+"?s="+this.siteid;var l=k[0]+"."+k[1];switch(k[1]){case"swf":j=this.swf("HolmesIcon"+c._n,l,k[2],k[3],"s="+m);break;case"gif":j='<a href="'+m+'" target="_blank"><img border="0" src="'+l+'" width="'+k[2]+'" height="'+k[3]+'"></a>';break;default:j='<a href="'+m+'" target="_blank">'+k[0]+"</a>"}a.write(j)}},addEvtLis:function(){var m=this.listener.length;if(m>0){for(var k=0;k<m;k++){var j=this.listener[k];var l=h(j.id);if(l){f(l,j.eventType,this.evtH())}}}},evtH:function(){var j=this;return function(l){var l=l||window.event;var m=l.target||l.srcElement;var k=l.clientX+":"+l.clientY;m.setAttribute("HM_fix",k);j.tags.et="1";j.tags.ep="{id:"+this.id+",eventType:"+l.type+"}";j.postData()}},getTracker:function(){for(var j in c){if(j.indexOf("_")!=0){this[j]=c[j]}}if(c.apiName==""){this.init()}},addLocLis:function(){var m=g.hash.substring(1);var l=new RegExp(this.siteid);var k=d.indexOf(c._allowdomain)>-1?true:false;if(m&&l.test(m)&&k){var j=a.createElement("script");j.setAttribute("charset","utf-8");j.setAttribute("type","text/javascript");j.setAttribute("src",this.protocol()+c._js_path+this.getValue("jn",m)+"."+this.getValue("sx",m));a.getElementsByTagName("head")[0].appendChild(j)}}};var b=new e();if(c.apiName!=""){window[c.apiName]=e}})();