Design and realization of website statistic function

Source: Internet
Author: User


This paper briefly introduces the design and implementation of statistical function of Web site.

This article is divided into the following five parts: buried Point design and implementation page introduction of data receiving data analysis of the storage and design and implementation of buried point

In JavaScript, there are many objects that can be used to get the user's data. For example, the Document object is used to parse each HTML document loaded into the browser, you can get the domain name, URL, and the title of the current document, the Navigator object contains information about the browser, you can get the value of useragent running the browser, the current system's language While the screen object can get information about the current display. Through these objects, we can get a fairly complete user information.
In addition, through other interfaces, you can also get the user's MAC address and IP address, and then can analyze the user's machine and the location of the provincial and municipal address.

We use JavaScript to obtain access information, to disguise the statistical code as a picture through the browser access trigger, the code is implemented as follows.

second, the introduction of the page

In the Web page to do statistics to introduce statistical scripts, and actively other interfaces to obtain the MAC and IP address in addition, a simple page design as shown in the code below.

third, data reception

Receive escalated data in the background interface. We use the PHP program to get get and post data to receive.

The data in the file log obtained by the above interface program is shown below.

17:38:25 http://www.fangbei.org?domain=www.fangbei.org&url=http%3A%2F%2Fwww.fangbei.org%2F_test%2Fstat.html &title=%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4&referrer=&sh=1920&sw=1080&cd=24& Useragent=mozilla%2f5.0%20 (linux%3b%20u%3b%20android%205.1.1%3b%20zh-cn%3b%20mi-4c%20build%2flmy47v)% 20applewebkit%2f533.1%20 (Khtml%2c%20like%20gecko) version%2f4.0%20mqqbrowser%2f5.4%20tbs%2f025483%20mobile% 20safari%2f533.1%20micromessenger%2f6.3.9.48_refecd3e.700%20nettype%2fwifi%20language%2fzh_cn&platform= Linux%20aarch64&language=zh-cn&usermac=185e0f88f5ef&apmac=185e0f88f5f0 17:38:25 17:38:25 _get:key: Domain Value:www.fangbei.org 17:38:25 _get:key:url; value:http://www.fangbei.org/_test/stat.html 17:38:25 _get:key:title; Value: Square double studio 17:38:25 _get:key:referrer; Value:17:38:25 _get:key:sh; value:1920 17:38:25 _GET:KEY:SW; value:1080 17:38:25 _GET:KEY:CD; Value:24 17:38:25 _get:key:useragent; value:mozilla/5.0 (Linux; U AndroiD 5.1.1; ZH-CN; MI-4C build/lmy47v) applewebkit/533.1 (khtml, like Gecko) version/4.0 mqqbrowser/5.4 tbs/025483 Mobile safari/533.1 micromessenger/6.3.9.48_refecd3e.700 Nettype/wifi language/zh_cn 17:38:25 _get:key:platform; Value:linux aarch64 17:38:25 _get:key:language; VALUE:ZH-CN 17:38:25 _get:key:usermac; Value:185e0f88f5ef 17:38:25 _get:key:apmac; Value:185e0f88f5f0 17:38:43 http://www.fangbei.org?domain=www.fangbei.org&url=http%3A%2F%2Fwww.fangbei.org% 2f_test%2fstat.html&title=%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4&referrer=&sh=1184&sw= 720&cd=24&useragent=mozilla%2f5.0%20 (Linux%3b%20u%3b%20android%204.4.2%3b%20zh-cn%3b%20h60-l01%20build %2FHDH60-L01)%20applewebkit%2f533.1%20 (Khtml%2c%20like%20gecko) version%2f4.0%20mqqbrowser%2f5.4%20tbs%2f025489 %20mobile%20safari%2f533.1%20micromessenger%2f6.3.9.48_refecd3e.700%20nettype%2fwifi%20language%2fzh_cn& Platform=linux%20armv7l&language=zh-cn&usermac=185e0f88f5ef&apmac=185e0f88f5f0 17:38:43 17:38:43 _get:key:domain; Value:www.fangbei.org 17:38:43 _get:key:url; value:http://www.fangbei.org/_test/stat.html 17:38:43 _get:key:title; Value: Square double studio 17:38:43 _get:key:referrer; Value:17:38:43 _get:key:sh; value:1184 17:38:43 _GET:KEY:SW; value:720 17:38:43 _GET:KEY:CD; Value:24 17:38:43 _get:key:useragent; value:mozilla/5.0 (Linux; U Android 4.4.2; ZH-CN; H60-l01 build/hdh60-l01) applewebkit/533.1 (khtml, like Gecko) version/4.0 mqqbrowser/5.4 tbs/025489 Mobile Safari/533.1 micromessenger/6.3.9.48_refecd3e.700 Nettype/wifi language/zh_cn 17:38:43 _get:key:platform; Value:linux armv7l 17:38:43 _get:key:language; VALUE:ZH-CN 17:38:43 _get:key:usermac; Value:185e0f88f5ef 17:38:43 _get:key:apmac; Value:185e0f88f5f0 17:38:50 http://www.fangbei.org?domain=www.fangbei.org&url=http%3A%2F%2Fwww.fangbei.org% 2f_test%2fstat.html&title=%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4&referrer=&sh=592&sw= 360&cd=32&userAgent=mozilla%2f5.0%20 (LINUX%3B%20ANDROID%204.4.2%3B%20H60-L01%20BUILD%2FHDH60-L01)%20AppleWebKit%2F537.36%20 ( Khtml%2c%20like%20gecko)%20version%2f4.0%20chrome%2f30.0.0.0%20mobile%20safari%2f537.36&platform=linux% 20armv7l&language=zh-cn&usermac=185e0f88f5ef&apmac=185e0f88f5f0 17:38:50 17:38:50 _get:key:domain; Value:www.fangbei.org 17:38:50 _get:key:url; value:http://www.fangbei.org/_test/stat.html 17:38:50 _get:key:title; Value: Square double studio 17:38:50 _get:key:referrer; Value:17:38:50 _get:key:sh; value:592 17:38:50 _GET:KEY:SW; value:360 17:38:50 _GET:KEY:CD; Value:32 17:38:50 _get:key:useragent; value:mozilla/5.0 (Linux; Android 4.4.2;
H60-l01 build/hdh60-l01) applewebkit/537.36 (khtml, like Gecko) version/4.0 chrome/30.0.0.0 Mobile safari/537.36 17:38:50 _get:key:platform; Value:linux armv7l 17:38:50 _get:key:language; VALUE:ZH-CN 17:38:50 _get:key:usermac; Value:185e0f88f5ef 17:38:50 _get:key:apmac; Value:185e0f88f5f0

iv. Data Warehousing

To do statistical analysis, the final data should be put on the database,

Database tables are designed as follows

After the storage is shown below

v. Statistical analysis

Finally, the data obtained is analyzed

For example, the SQL query statement of yesterday's traffic is as follows

The resulting graph is as follows

The other generated statistical charts are as follows

Two analysis based on number of visits-customer loyalty statistics are as follows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.