网站统计代码v1.0
var m = {}; var p ={}; var gifUrl = 'http://hm.iwgame.test/v.gif'; (function() { //参数组合类 m = { ck : 0, p : '', la : '', le : '', rnd: '', st : '', sv : '', lt : '' }; //工具方法 var utils = {}; //全局变量类 var c = {}; c.cookieEn = /\.(iwgame|shumenol|zuixiaoyao).(test|com)/.test(window.location.href); c.search = window.location.search ? window.location.search.substring(1) : '';//当前页查找字符串 c.url = window.location.href; c.domin = c.url.match(/(iwgame|shumenol|zuixiaoyao)\.(test|com)/g)[0]; c.r = null;//默认对象返回值 utils.k = {};//定义属性类 utils.k.ua = /msie (\d+\.\d+)/i.test(navigator.userAgent);//判断是否是IE utils.k.cookieEnabled = navigator.cookieEnabled;//cookieEnabled 属性可返回一个布尔值,如果浏览器启用了 cookie,该属性值为 true。如果禁用了 cookie,则值为 false。 utils.k.language = navigator.language || navigator.browserLanguage || navigator.systemLanguage || navigator.userLanguage || "";//页面使用的语言类型 //工具类cookie对象 utils.cookie ={}; //设置cookie utils.cookie.set = function(name, val, parm) { if(c.cookieEn){ var d; parm.G && (d = new Date, d.setTime(d.getTime() + parm.G)); document.cookie = name + "=" + val +(d ? "; expires=" + d.toGMTString() : "") +'; domain='+ (parm.domin ? parm.domin : '') +'; path='+(parm.path ? parm.path : '')+';'; }else{ return; } }; //获取cookie utils.cookie.get = function(name) { return (name = RegExp("(^| )" + name + "=([^;]*)(;|$)").exec(document.cookie)) ? name[2] : c.r }; //工具类url处理对象 utils.url = {}; //获取产品ID utils.url.getpId = function(){ var script = document.getElementsByTagName('script'); var _l = script.length; for(var scriList = 0; scriList < _l; scriList++){ if(/\?.*p=(\d)+/.test(script[scriList].src)){ return 'p-p'+RegExp.$1; } } return ''; }; //获取当前域名 utils.url.getDomin = function(){ return document.domain ? document.domain : ''; }; //创建uuid utils.uid = {}; utils.uid.uuid = function(){ var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } //获取创建uuid的时间 utils.uid.time = function(){ var str = utils.cookie.get('LAID') ? utils.cookie.get('LAID').split('@')[1] : ''; return str; }; //广告类型对象 utils.st ={}; utils.st.isExist = function(a){ if(/stat=.*/ig.test(a)){ return true; } return false; }; utils.st.getSearName = function(name){ var b = []; var temp = c.search; b = temp.split('&'); for(var i=0;i<b.length;i++){ if(name == b[i].split('=')[0]){ return b[i].split('=')[1]; } } return ''; } //工具类关于数字对象 utils.num = {}; utils.num.rand = function(num){ var a = ''; for(var i=0;i<num;i++){ a += Math.floor(Math.random()*10); } return a; }; c.la = '';//LAID的值 //创建cookieLAID (function(){ var uid = utils.uid.uuid().toString(); var d = parseInt(new Date().getTime()/1000); var mess_u = uid + '@' + d; if(!utils.cookie.get('LAID')){ utils.cookie.set('LAID',mess_u,{'G':20*365*24*3600*1000,'domin':c.domin}); } }()); //广告类型 c.st = ''; (function(){ if(utils.st.isExist(c.search)){//如果设置了stat var statId = utils.st.getSearName('stat'); var stype = !!utils.st.getSearName('stype') ? utils.st.getSearName('stype') : 'ad'; var mess_u = statId + ',' + stype; if(!utils.cookie.get('LARC')){ utils.cookie.set('LARC',mess_u,{'G':24*3600*1000,'domin':c.domin}); }else{ if(utils.cookie.get('LARC') != mess_u){ utils.cookie.set('LARC',mess_u,{'G':24*3600*1000,'domin':c.domin}); } } m.st = utils.cookie.get('LARC').split(',')[1]; m.sv = utils.cookie.get('LARC').split(',')[0]; }else{ if(utils.cookie.get('LARC')){ m.st = utils.cookie.get('LARC').split(',')[1]; m.sv = utils.cookie.get('LARC').split(',')[0]; }else{ m.st = ''; m.sv = ''; } } }()); //拼接参数 m.ck = utils.k.cookieEnabled ? 1:0; m.p = utils.url.getpId(); m.la = !!utils.cookie.get('LAID') ? utils.cookie.get('LAID') : ''; m.le = utils.uid.time(); m.rnd = utils.num.rand(10); //对外接口 //设置cookie方法 p.setCookie = function(name,val,parm){ utils.cookie.set.call(this,name,val,parm); } //获取LAID方法 p.getLaid = function(){ var s = utils.cookie.get.call(this,'LAID'); return s; }; //获取LARC方法 p.getLarc = function(){ var s = utils.cookie.get.call(this,'LARC'); return s; }; })(); function lvAnHmSetHm(){ var listC = '';//参数字符串 var _L = arguments.length; if(arguments.length == 0){ return; }else{ m.rnd = (function(){ var a = ''; for(var i=0;i<10;i++){ a += Math.floor(Math.random()*10); } return a; })(); m.lt = parseInt(new Date().getTime()/1000); for(sinde in m){ if(sinde == 'ck'){ listC += sinde+'='+ encodeURIComponent(m[sinde]); }else{ listC += '&'+sinde+'='+ encodeURIComponent(m[sinde]); } } listC += '&vt='+arguments[0]; for(var i=1;i<_L;i++){ listC += '&v'+ arguments[0] +''+i+'='+encodeURIComponent(arguments[i]); } listC += '&nu='+ encodeURIComponent(window.location.href); listC += '&su='+ encodeURIComponent(document.referrer); var M = {}; M.log = function(a, b) { var e = new Image, d = "lv_log_" + Math.floor(2147483648 * Math.random()).toString(36); window[d] = e; e.onload = e.onerror = e.onabort = function() { e.onload = e.onerror = e.onabort = null; e = window[d] = null; b && b(a); }; e.src = a }(gifUrl+'?'+listC,function(str){ //error }); } } lvAnHmSetHm(1);