zsx's Old Blog

黑历史逐步隐藏中_(:з」∠)_仅保留部分可能有些价值的文章,并不保证将来的可访问性。

百度统计ASP版+ZBLOG WAP应用


代码高亮出现问题,正在修正中






首先,我们需要从这里得到ID号:

打开百度统计,点击网站中心--获取代码--WAP站访问分析代码,复制画圈处

image


保存以下代码【UTF-8】到根目录,、命名为【baidutongji_wap.asp】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<script language="javascript" runat="server">
/*
百度统计 WAP统计 ASP JavaScript Edition
欢迎使用Z-Blog 2.0,最强大的基于ASP平台开发的博客程序
*/
function bdtj(){
   this.siteid="";
   this.Version = "wap-1-0.1";
   this.VisitDuration = 1800;
   this.VisitorMaxAge = 31536000;
   
   this.searchEngineList = {
       id:[1,2,4,6,7,8,11,12,13,14,14,15,16,17,18]
       ,hs:["baidu.com","google.com","sogou.com","search.yahoo.com","yahoo.cn","soso.com","youdao.com","gougou.com","bing.com","so.com","so.360.cn","jike.com","qihoo.com","etao.com","soku.com"]
       ,wd:["word|wd","q","query","p","q","w","q","search","q","q","q","q","kw","q","keyword"]
   };
   
   this.searchEngine = "";
   this.searchWord = "";
   
   this.GetRandomNumber=function() {
       return Math.random();
   }
   
   this.GetSecondsSinceEpoch=function(time) {
       return new Date().getTime();
   }
   
   this.getQueryValue=function(url,key) {
       var regex=new RegExp("(^|&|\\?|#)(" + key + ")=([^&#]*)(&|$|#)").exec(url);
       
       if (f!=null) {
           return f[3];
       } else {
           return "";
       }
   }
   
   this.getHost=function(url){
       if(typeof(url)!="undefined"){
           url=url.split("/");
           return url[0]+"//"+url[2]+"/"
       }
       else{
           return "";
       }
   }
   
   this.GetSourceType=function(path,referer,currentPageVisitTime,lastPageVisitTime) {
       if (referer == "" || this.getHost(path) == this.getHost(referer) ) {
           if (currentPageVisitTime - lastPageVisitTime > this.VisitDuration) {
               return 1;
           } else {
               return 4;
           }
       } else {
           for (var i = 0; i < this.searchEngineListlLength / 3; i++) {
               if (new RegExp(this.searchEngineList.wd[i]).test(referer)) {
                   this.searchWord = this.getQueryValue(referer, this.searchEngineList[i, 2]);
                   if (this.searchWord != "" || this.searchEngineList.id[i] == 2 || this.searchEngineList.id[i] == 14 || this.searchEngineList.id[i] == 17)
                       this.searchEngine = this.searchEngineList.id[i];
                       return 2;
                   }
               }
           }
           return 3;
       }
   
   
   this.TrackPageView=function() {
       var path = "";
       if (typeof(Request.ServerVariables("URL")) != "undefined") {
           path = Request.ServerVariables("URL").Item.split(this.getHost(Request.ServerVariables("URL").item))[1];
       }
   
       var referer = "";
       if (typeof(Request.ServerVariables("HTTP_REFERER")) != "undefined"
               && "" != Request.ServerVariables("HTTP_REFERER").Item) {
           referer = Request.ServerVariables("HTTP_REFERER").Item;
       }
   
       var currentPageVisitTime = this.GetSecondsSinceEpoch(new Date().toString());
   
       var lastPageVisitTime = 0;
       var cookie = Request.Cookies("Hm_lpvt_" + this.siteid).Item;
       if (typeof(cookie)!="undefined") {
           lastPageVisitTime = cookie;
       }
   
       var lt = "";
       cookie = Request.Cookies("Hm_lvt_" + this.siteid).Item;
       if (typeof(cookie)!="undefined") {
           lt = cookie;
       }
   
       var sourceType = this.GetSourceType(path, referer, currentPageVisitTime, lastPageVisitTime);
       var isNewVisit = (sourceType == 4) ? 0 : 1;
   
       Response.Cookies("Hm_lpvt_" + this.siteid)=currentPageVisitTime.toString();
       Response.Cookies("Hm_lpvt_" + this.siteid).Path="/";
   
       Response.Cookies("Hm_lvt_" + this.siteid) = currentPageVisitTime.toString();
       Response.Cookies("Hm_lvt_" + this.siteid).Path = "/";
       Response.Cookies("Hm_lvt_" + this.siteid).Expires = this.GetDate(new Date())// + TimeSpan.FromSeconds(this.VisitorMaxAge);
   
       var utmGifLocation = "http://hm.baidu.com/hm.gif";
   
       var utmUrl = utmGifLocation + "?" + "si=" + this.siteid +"&et=0" +"&nv=" + isNewVisit + "&st=" + sourceType +   (this.searchEngine != "" ? "&se=" + this.searchEngine : "") +   (this.searchWord != "" ? "&sw=" + Server.URLEncode(this.searchWord) : "") + (lt != "" ? "&lt=" + lt : "") + (referer != "" ? "&su=" + Server.URLEncode(referer) : "") + "&v=" + this.Version +  "&rnd=" + this.GetRandomNumber();
   
       return Server.HTMLEncode(utmUrl);
   }
   
   this.GetDate=function(date){
       var o=date;//new Date(date);
       return o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDay()+" "+o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()
   }
}
function baidutongji(){
   var bdtongji=new bdtj();
   bdtongji.siteid="上文提到的代码"
   return bdtongji.TrackPageView();
}
</script>

然后,我们修改一下WAP.ASP:

找到第九十四行

1
<div id="ft">Powered By <ahref="http://bbs.rainbowsoft.org">Z-Blog</a></div>

在之前加入:

1
2
<!-- #include file="baidutongji_wap.asp" -->
<img src="<%=baidutongji()%>" width="0" height="0" />

保存,就可以了

控制面板
您好,欢迎到访网站!
  查看权限
Google Adsense
文章归档
站点信息
  • 文章总数:259
  • 页面总数:10
  • 分类总数:17
  • 标签总数:136
  • 评论总数:1644
  • 浏览总数:216659

Powered By Z-BlogPHP 1.5.1 Zero

闽ICP备15006942号   闽公网安备 35010302000147号