var refer; var ref_site=""; var ref_channel=""; var ref_way; refer = document.referrer; splitRef(refer); function splitRef(refer){ if(refer.length >0 && refer != "undefined") { ref_way = 1;//链接导入 var arrPath = refer.split("/"); //拆分 var iLevel = 5; //需要截取的层次,现在是3层,因为要去掉http://这两个/,所以为5 var tSite = arrPath[2]; if (tSite.indexOf("21cn") == -1) {//判断是否为21cn的网址 ref_site = tSite; isSearchEngine(ref_site);//判断是否为搜索引擎 } else { var tHost = document.location.hostname.split("."); ref_site = tHost[0]; } ref_channel = ref_site; for (i = 3; i < arrPath.length && i < iLevel; i++) { if (arrPath[i].indexOf(".") == -1) { ref_channel += "_" + arrPath[i]; } else { ref_channel += "_"; } } for (j = 0; j < iLevel - i; j++) { ref_channel += "_"; } } else { ref_way = 0;//直接登陆 } return true; } function isSearchEngine(ref_site){ var enginer = ['baidu.com', 'www.google', 'qq.com', 'msn.com', 'tom.com', 'sogou.com', 'yahoo.com', 'iask.com', 'search.114.vnet.cn', 'yisou.com', '3721.com']; for (i = 0; i < enginer.length; i++) { if (ref_site.indexOf(enginer[i]) != -1) { ref_way = 2;//搜索引擎 return true; } } return false; } //以上是取页面导入信息,以下为pv信息 //取出频道名 var arrHost = document.location.hostname.split("."); var sSite = arrHost[0]; var sChannel = arrHost[0]; //取出栏目名 var sPath = document.location.pathname; //URL路径 var arrPath = sPath.split("/"); //拆分 var iLevel = 3; //需要截取的层次,现在是3层 for (i=1; i"+"<"+"/script>");