首页 > 代码库 > 随笔-cnzz,百度统计,异步换统计,地址栏换地址

随笔-cnzz,百度统计,异步换统计,地址栏换地址


*******************************

<script>
//百度统计
var _hmt = _hmt || [];
_hmt.push([‘_setAccount‘, ‘a2915193765b4211795685124561a792‘]);

//声明_czc对象:
var _czc = _czc || [];
//绑定siteid,请用您的siteid替换下方"XXXXXXXX"部分
_czc.push(["_setAccount", "3218787"]);
</script>

************************************ajax异步请求,地址栏改变,每个url都要被cnzz和百度统计
$.ajax({
        url: url,
        async :true,
        data:"contentId=10001",
        success:function(data){
            var hostUrl = "http://"+window.location.host;
            var address = hostUrl+文章相对路径;  //得到完整url
            var state = {                     
                title: document.title,
                url: address
            };
            if(window.applicationCache){
                window.history.pushState(state, document.title, address);  //html5异步加载的时候,改变地址栏
            }
            _hmt.push([‘_trackPageview‘, contentUrl]);                     //ajax异步,百度,cnzz统计
            var referer_url = contentUrlsTemp[mbIndex-1];                  //取当前的上一个url
            _czc.push([ "_trackPageview",contentUrl,referer_url]);
            last_mb20.after(data);                                         //追加文章内容
        }
});


********************************尾部引用
<div>
<script src="http://s16.cnzz.com/stat.php?id=113218787&web_id=113218787&show=pic1" language="JavaScript"></script>
<!--cnzz news-->
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id=‘cnzz_stat_icon_121153747111‘%3E%3C/span%3E%3Cscript src=http://www.mamicode.com/‘" + cnzz_protocol + "s4.cnzz.com/stat.php%3Fid%3D1253747111%26show%3Dpic‘ type=‘text/javascript‘%3E%3C/script%3E"));</script>
<!--cnzz news-->
<script type="text/javascript">
    var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    document.write(unescape("%3Cscript src=http://www.mamicode.com/‘" + _bdhmProtocol + "hm.baidu.com/h.js%3Fa2915193765b4211795685124561a792‘ type=‘text/javascript‘%3E%3C/script%3E"));
</script>
<script src=http://www.mamicode.com/‘http://stat.e.tf.360.cn/search/c.js?u=1333264144‘ language=‘JavaScript‘ ></script>
<script src=http://www.mamicode.com/‘http://pw.cnzz.com/tongji_360.php?id=12535471011&pid=e360&l=2‘ language=‘JavaScript‘ charset=‘gb2312‘></script>
</div>

随笔-cnzz,百度统计,异步换统计,地址栏换地址