Google Analytics and Baidu statistics are different, and the difference is very large, the fundamental reason is that the principle of data statistics and mechanism is not. Below share Google Analytics and Baidu statistics to make the principle analysis.
Analysis of the working principle of Baidu statistics
Baidu statistics provided by JS, is essentially to the page to introduce hm.baidu.com/h.js this code, the content of the code will be based on the following parameters are different, h.js? The back of the parameter is your Baidu statistics in the ID.
Get the H.js code at the same time, Baidu statistics will go to your browser to write a name "Hmaccount" cookies, the cookie expires in 2038, so as long as you do not empty the browser cookie, the basic will never expire.
When H.js is downloaded, it executes its script to obtain some browser-related information and access sources, including screen size, color depth, flash version, user language, and so on.
From the JS code can be obtained, all parameters include these: "Cc,cf,ci,ck,cl,cm,cp,cw,ds,ep,et,fl,ja,ln,lo,lt,nv,rnd,sb,se,si,st,su,sw,sse,v." The meaning of these parameters is roughly as follows:
CC: Not sure, generally 1
Value of Cf:url parameter HMSR
Value of Ci:url parameter HMCI
CK: Do you support Cookie 1:0
CL: Color depth such as "32-bit"
Value of Cm:url parameter HMMD
Value of Cp:url parameter Hmpl
Value of Cw:url parameter hmkw
DS: Screen size, such as ' 1024x768′
EP: The initial value is ' 0′, time variable, reflect the page stay time, the format is probably: now time-loading time + "," + another very small time value
ET: The initial value is ' 0′, if the EP time variable is not 0, it will become the other
Fl:flash version
Ja:java Support 1:0
ln: Language ZH-CN
Lo: I do not know, generally 0
LT: Date time.time (), such as "1327847756", at first request no
NV: I don't know, usually 1 or 0.
Rnd: 10-digit random number
SB: If it is 360se browser the value is equal to ' 17 '
SE: and search engine related
SI: Statistic code ID
St:
Su: Previous page document.referrer
SW: Not sure, estimated and search engine related, generally empty
SSE: Not sure, estimate and search engine related, generally empty
V: The version of the statistic code, currently the value is "1.0.17"
When these parameters are set (some of the parameters are not assigned), the parameters that have been assigned are filtered out and a URL is pieced together as the hm.baidu.com/hm.gif parameter, such as: http://upload.chinaz.com//?cc=1&ck= 1&cl=32-bit& DS=1366X768&EP=0&ET=0&FL=11.0&JA=1&LN=ZH-CN. Then request the picture.
Baidu statistics server, by receiving this request, and from the image of the URL attached to the parameters to obtain relevant information, record the visitor access record; When the page is closed by the user, it also triggers the process of requesting hm.gif, but this process is not supported by all browsers and all shutdown actions.
Using the Wireshark (a network grab tool) test you can find that the browser sent a total of 4 requests to the server side:
Request a section of JS script.
Start the request at the end of loading and pass the parameter
When you exit the page, make a request, and pass the parameters, compared to the above, found that the EP parameters have changed.
Baidu statistics is based on cookies, when the request JS script, will be in your computer to save a permanent cookie, the cookie as your user identity. At the same time, it was found that the parameter EP changed from the first 0 to the "7289%2c115", and the Escape was "7289,115", which is the two-millisecond unit, that is, 7.2 seconds and 0.1 seconds. At the same time the first two requests hm.gif the LT parameter (time, javascript: (new Date). GetTime ()) is invariant. Rnd Random numbers change every time.
How Google Analytics Works
When a user accesses a page that contains Google Analytics statistics, the code is executed by the user's browser, which is used to collect information about the visitor, such as the URL of the page, browser type, operating system, system language, screen resolution, and so on.
The GA statistic code then stores the guest information in a cookie, which is a short piece of text, stored locally, associated with the visited site, and is used to determine whether a user is an initial or multiple visit, a recommended source of the page, and subsequent page browsing information.
Finally, all the collected information is sent to the Google Analytics data server. This process is clever, we know that the server log file records every time the file request information, and the way Google Analytics collect data is by requesting a transparent 1x1 GIF image file to the server, the file request and request time will be recorded in the server log, The file request information contains the data and cookie information collected by the GA statistic code, so that whenever the GIF picture receives a request, the visitor's access information is collected by Google Analytics data server.
However, Google Analytics only send a GIF request, many times will send more than one GIF request. If a GIF picture cannot be counted, then GA sends other GIF requests,
Summarize:
Web Analytics Master Avinash once said that as long as the data has a 90% accuracy, then you can take action in time. It is important to be able to see trends, and then to take action, and then to test and continuously optimize.
Article Source: Lou's blog, reproduced please indicate this address, thank you.