Monday, February 25, 2013

How Google Analytics Tracking Code Works

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.
GATC Request Process

No comments:

Post a Comment