Design and realization of website statistic function

Source: Internet
Author: User

Keywords: Web site statistics Design implementation
Square Double Studio
Original: http://www.cnblogs.com/txw1958/p/website-statistic-analysis.html

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

This article is divided into the following five sections:

    1. Design and realization of buried point
    2. Page Introduction
    3. Data reception
    4. Data warehousing
    5. Statistical analysis
Design and realization 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=185e0f88f5f017:38:25 17:38:25 _get: Key:domain; Value:www.fangbei.org17:38:25 _get:key:url; value:http://www.fangbei.org/_test/Stat.html17:38:25 _get: Key:title; Value: Square Double Studio 17:38:25 _get: Key:referrer; Value:17:38:25 _get:key:sh; Value:192017:38:25 _GET:KEY:SW; Value:108017:38:25 _GET:KEY:CD; Value:2417: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_cn17:38:25 _get: Key:platform; Value:linux aarch6417:38:25 _get:key:language; value:zh-Cn17:38:25 _get: Key:usermac; Value:185e0f88f5ef17:38:25 _get: Key:apmac; value:185e0f88f5f017: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=185e0f88f5f017:38:43 17:38:43 _get: Key:domain; Value:www.fangbei.org17:38:43 _get:key:url; value:http://www.fangbei.org/_test/stat.html17:38:43 _get: Key:title; Value: Square Double Studio 17:38:43 _get: Key:referrer; Value:17:38:43 _get:key:sh; Value:118417:38:43 _GET:KEY:SW; Value:72017:38:43 _GET:KEY:CD; Value:2417: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_cn17:38:43 _get: Key:platform; Value:linux armv7l17:38:43 _get:key:language; value:zh-cn17:38:43 _get: Key:usermac; value:185e0f88f5ef17:38:43 _get: Key:apmac; Value:185e0f88f5f017: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=185e0f88f5f017:38:50 17:38:50 _get: key:domain; Value:www.fangbei.org17:38:50 _get:key:url; value:http://www.fangbei.org/_test/stat.html17:38:50 _get: key:title; Value: Square Double Studio 17:38:50 _get: key:referrer; Value:17:38:50 _get:key:sh; Value:59217:38:50 _GET:KEY:SW; Value:36017:38:50 _GET:KEY:CD; Value:3217: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.3617:38:50 _get: key:platform; Value:linux armv7l17:38:50 _get:key:language; value:zh-cn17:38:50 _get: Key:usermac; Value:185e0f88f5ef17: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

Design and realization of website statistic function

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.