How Google Analytics Works

Understanding the architecture of the Google Analytics system—how it collects data, identifies visitor and creates reports—is the key to understanding many of the advanced topics that will be discussed later in this Short Cut. Before we begin discussing filters, goals, and advanced implementations, let's review the fundamentals of how the system works.

Data Collection and Processing

I'm going to explain how Google Analytics collects, processes, and displays data using Figure 1. The data collection process begins when a visitor requests a page from the web server. The server responds by sending the requested page back to the visitor's browser (step #1). As the browser processes the data, it contacts other servers that may host parts of the requested page. This is the case with the Google Analytics Tracking Code (GATC).

Google Analytic processing flow

Figure 1. Google Analytic processing flow

The visitor's browser requests the code from a Google Analytics server (step #2), and the server responds by sending the code to the visitor's browser. All of the code is contained within one file named urchin.js. Once the browser receives the code, the GATC begins to execute while the rest of the page loads.

During execution, the code identifies attributes of the visitor and his browsing environment, such as how many times he's been to your site, where he came from, etc.

After all the appropriate data has ...

Get Google Analytics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.