How Google Analytics Works
Looking under the hood of Google Analytics will help you understand what the numbers really mean.
Understanding Google Analytics reports and capabilities requires an understanding of the basic principles. Knowing what data Google Analytics can capture and how it interprets it is key to making sense of the software.
At its most basic level, Google Analytics consists of
- JavaScript code on each page of a website,
- log files on Google's servers and
- a processing engine that populates reports in your account.
1. Google Analytics JavaScript Code
When a visitor arrives at a page with tracking code, the code is executed by his browser. It collects information about the visitor's browser and computer settings, like screen resolution, operating system, etc. The script's visibility is pretty limited. It can typically only see what it's told.
The script then sets a few cookies containing some basic visit information. These cookies determine whether it is a new or returning visitor, among other things.
2. Storing the Information in Log Files
Finally, all of this information must be sent to the Google Analytics servers so that it can be processed. Since servers keep logs of every file requested from them, the code sends the information by requesting a very small file, named __utm.gif. Requesting that file will create a record in the log with a timestamp. It appends all the cookie data and information it just collected to the query string for __utm.gif. This way, Google's servers have a record of when a file was requested and all of the visitor information about that pageview.
3. Processing Visit Information
In the last step, Google Analytics processes all of the log files and pushes the data into your account, through the filters and into individual profiles.
The processing does not happen in real-time. Visit data is typically processed every few hours, although this frequency has been increasing over time.
Pros and cons to Google Analytics
There are a few important points to consider with this approach.
__utm.gif is Critical
First, if the __utm.gif file never gets requested from the GA servers and a log file isn't created, Google Analytics will never know about it. Therefore, any visits to your site that don't execute the JavaScript file won't get counted. This includes robots and spiders. Likewise, if you take the code off your site or misconfigure it so that it's not working properly, the visits during that period will be lost forever.
Track Cached Pages
Second, Google Analytics will track visits to a page even if it's been cached (i.e. stored in your browser's memory). This is because the cookies include timestamps and the cookie values are included in the __utm.gif file request, so the file name changes with every pageview. A new request for the file will be made every time a page is viewed, including when a visitor refreshes the page or hits the back button.
Cookie Manipulation
Because Google Analytics relies so heavily on cookies, any manipulation of them will result in misinterpretations. For example, if a visitor deletes his cookies, he will be seen as a new visitor in his next visit, and all his traffic source information from previous visits will be lost.
This also means, though, that if there are multiple users on a computer, they will be seen as the same visitor. Also, a visitor using two computers will be seen as two different visitors.
This is one of many reasons that web analytics reports ought to be viewed as a survey sample and not as concrete fact.
No Reprocessing
It's important to remember that Google Analytics data is processed remotely. Users don't have control over how or where it's processed. That means that once data is in the account, it's there for good. Mistakes in historical data can't be reprocessed.
To avoid mixing good data with bad, we recommend creating a duplicate profile to use as a sandbox. Apply filters to the sandbox to see what impact they will have before applying them to your production profile.
Google Analytics on Different Servers
All of the Google Analytics code is client-side, so it doesn't matter what server or CMS the website is hosted on. Different browsers might treat the code a little bit differently, but as long as the server displays the JavaScript code correctly, the code never has to interact with the site's server.












Comments
Google Analytics
Google Analytics is also the view of an immediate result of any improvement of a website (or a unique page), meaning that a good optimization work is operating in a correct way...