What is a Tracking Code?
Tracking Code – A script, often placed in the header, footer, or thank you page of a website that passes information along to software tools for data gathering purposes. Tools like Google Analytics, Google Adwords utilize tracking codes so that they can track information about users who view a site.
Because your website configuration and reporting needs might differ from a standard setup, it’s a good idea to understand the general tracking process to ensure that your reports deliver data as you expect. In this way, you can decide how to configure Analytics tracking to best suit your own website.
How Does Google Analytics Collect Data?
The data that Google Analytics uses to provide all the information in your reports comes from these sources:
The HTTP request for any web page contains details about the browser and the computer making the request, such as the hostname, the browser type, referrer, and language. In addition, the 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, and Referring Sites reports. Analytics also sets and reads first-party cookies on your users’ browsers in order to obtain user session and any ad campaign information from the page request. The Google Analytics Tracking Code also reads the DoubleClick cookie to get information about the Display Features.
When all this information is collected, it is sent to the Analytics servers in the form of a long list of parameters attached to a single-pixel GIF image request. The data contained in the GIF request is the data sent to the Google Analytics servers, which then gets processed and ends up in your 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:
- A browser requests a web page that contains the tracking code.
- An <script>element is created and enabled for asynchronous loading (loading in the background).
- 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.
- Loads the script element to the DOM.
- After the tracking code collects data, the GIF request is sent to the Analytics database for logging and post-processing.
« Back to Glossary Index