Google Analytics Short Info

Google Analytics (GA) is the enterprise-class web analytic solution that gives website owners rich insights into website traffic and marketing effectiveness. Powerful, flexible and easy-to-use features now let users see and analyze traffic data in an entirely new way. With GA, you're more prepared to write better-targeted ads, strengthen your marketing initiatives and create higher converting websites.

GA works by the inclusion of a block of JavaScript code on pages in the website. When website visitors view a page, this JavaScript code references a JavaScript file which then executes the tracking operation for Analytics. The tracking operation retrieves multiple different data about the page request through various means and sends this information to the Analytics server. This information to Analytics server are transferred via a list of parameters attached to a single-pixel image request.

The data that GA uses to provide all the information in analytic reports are coming from following sources:

  • The HTTP request of the visitor
  • Browser/system information
  • First-party cookies

The HTTP request for any web page contains details about the browser and the computer making the request, such as the host-name, type of the browser, page referrer and language. In addition, the Document Object Model (DOM) of most browsers provides access to more detailed browser and system information, such as Java and Flash support and screen resolution. Analytics uses this information in constructing reports like the Map Overlay, Browser Report and Referring Sites reports. GA also sets and reads first-party cookies on browsers in order to obtain visitor session and any ad campaign information from the page request. After all this information is collected it is sent to the GA server via parameters attached to a single-pixel image request.

The data contained in the GIF image request is the data sent to the GA servers, which then gets processed and ends up in reports. Here is an example of only a portion of a GIF request:

How the Tracking Code Works

In general, the Google Analytics Tracking Code (GATC) retrieves web page data as follows:
1. A browser requests a web page that contains the tracking code.
2. A JavaScript Array named _gaq is created and tracking commands are pushed onto the array.
3. A <script> element is created and enabled for asynchronous loading (loading in the background).
4. The ga.js tracking code is fetched, with the appropriate protocol automatically detected. Once the code is fetched and loaded, the commands on the _gaq array are executed and the array is transformed into a tracking object. Subsequent tracking calls are made directly to Google Analytics.
5. Loads the script element to the DOM.
6. After the tracking code collects data, the GIF request is sent to the Analytics database for logging and post-processing.

In the next blog post I will write more about GA. I will explain how to add GATC into Drupal 7 site.

Blog Image: