网站对于功能性代码,如CNZZ这种代码,假设你有50个站点,实际只需要调用一个JS就可以分别对50个站点独立监控,以免写很多个js,这样也便于操作。如创建一个公共js:cnzz.js。代码内容为:
thisurl = document.URL; var sign_url =null; document.write('<span style="display:none">'); //www.weguiding.com 的统计代 if(thisURL.indexOf('www.weguiding.com')>0) { var cnzz_protocol = (("HTTPS:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1271191319'%3E%3C/span%3E%3CscrIPt src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1271191319' type='text/JavaScript'%3E%3C/script%3E"));} //m.weguiding.com 的统计代码 if(thisURL.indexOf('m.weguiding.com')>0) { var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1261060817'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1261060817' type='text/javASCript'%3E%3C/script%3E")); } document.writeln('</span>');
核心技巧为:通过js判断当前域名,然后自动调用当前域名的cnzz对代码。
if花括号中填写以下图示中脚本标签中包含的内容即可
多站点的添加直接复制下图中的机构体,修改对应的域名和cnzz代码即可