javaScript怎么做到统计访问量?


网上搜了一下发现静态网站统计貌似有点麻烦。
http://my.oschina.net/ailingling/blog...
就去谷歌了下。

第一个网站

http://www.webestools.com/visitors-co...

Welcome on the visitors counter,
A visitors counter is a counter which simply count the number of visitors of a web site. A visitor is counted only 1 time per day.
Our visitors counter is free and you don't need to register on Webestools to be able to use it. We offer you various counter styles, you also have the possibility to choose the start number and the minimum number of digits the counter should display. Then, you canpreview the result by clicking on the "Preview" button. If your counter looks good, you only have to click on the "Create" button to get the (X)html code that you have to copy on your website to show the visitors counter.

这个就一个JS

<div style="text-align:center;"><script type="text/javascript" src="http://services.webestools.com/cpt_visitors/27120-13-6.js"></script></div></a>

插入HTML就可以统计了。。这是什么原理?

这个引用的JS里面

[javascript]document.write("<a href=\"http://www.webestools.com/visitors-counter-free-number-unique-visitors-users-visits-statistics.html\"><img src=\"http://services.webestools.com/images/s13_0.gif\" class=\"cpt_viu_27120\" alt=\"0\" style=\"border:0px;\" /><img src=\"http://services.webestools.com/images/s13_0.gif\" class=\"cpt_viu_27120\" alt=\"0\" style=\"border:0px;\" /><img src=\"http://services.webestools.com/images/s13_0.gif\" class=\"cpt_viu_27120\" alt=\"0\" style=\"border:0px;\" /><img src=\"http://services.webestools.com/images/s13_0.gif\" class=\"cpt_viu_27120\" alt=\"0\" style=\"border:0px;\" /><img src=\"http://services.webestools.com/images/s13_0.gif\" class=\"cpt_viu_27120\" alt=\"0\" style=\"border:0px;\" /><img src=\"http://services.webestools.com/images/s13_2.gif\" class=\"cpt_viu_27120\" alt=\"2\" style=\"border:0px;\" /></a>");[/javascript]

请问下它是怎么做到的?

JavaScript

面纸面纸面纸 8 years, 10 months ago

网站的流量,访问次数之类的是有地方可以查询到的,http://services.webestools.com/cpt_visitors/27120-13-6.js
你插的这个js实际上他先查询了你网站的流量然后再document.write(),
至于怎么知道你网站的域名的,有个属性叫做refer,
别问我怎么知道的,其实我也是猜的

ajiahan answered 8 years, 10 months ago

Your Answer