How Does Google Analytics Actually Work?

Tim Marco

By Tim Marco

Google Analytics is a great service for many reasons, not the least of which is its price tag of zero. Another of its great advantages is that site owners just have to follow a few simple steps before being able to track most–but not all–visitors to their site. After signing up for an account and adding a small snippet of code to every page, site owners are ready to track a wealth of information. But not every visitor can be tracked, and not all types of interaction can be recorded with the basic installation of Google Analytics. And the reasons for both of these limitations are caused by the internal workings of GA itself. Its guts, if you’ll excuse the metaphor. With that in mind, I’m hoping that this post will help demystify what’s actually going on in Google Analytics. Specifically, I’m going to focus on how GA collects information from a site’s visitors. With a better understanding of this process, you should be able to recognize situations wherein Google Analytics might not be providing your site with very accurate information.  

How Does Google Analytics Collect Information About Visitors?

GA uses a programming language called Javascript to transmit information to Google’s servers about site visitors. Nearly twenty years old, Javascript is an (almost) universal language that allows coders and developers to make sites interactive. You may know that when you see a website, the text, images, and other information contained in a page are saved in HTML format, which your browser decodes and displays. An easy way to think about this is that HTML is like the .doc file format used for Microsoft Word Documents. Like a Word Document, an HTML file can tell the computer what text to display, where to include images and tables, and what formatting to use. But unlike a Word document, HTML pages are read-only. This means that, without the help of a language like Javascript, an HTML page won’t let you do much interacting with a site; you can’t change text and your computer can’t communicate with a server. Javascript gets around that limitation. Because it is a standardized language, a strong majority of browsers can take instructions written in Javascript and provide additional interactivity.

Everything from flyout menus to popup windows are possible thanks to Javascript. But importantly for Google Analytics, Javascript allows your computer to send and receive messages to other computers connected to the internet. When you visit a site that has implemented Google Analytics, the site will ask your computer to temporarily download some Javascript instructions from Google Analytics. That code, in turn, will ask your browser to send some important pieces of data to Google’s servers. These data include the specific web page that you are viewing, some technical information about your computer (such as if you are using a Windows or Mac machine), how you arrived at the site, and the way that you navigate throughout its pages.

Studies have shown that around 50% of the top million websites on the internet utilize GA. This means that most of the time you are online, your information is being sent to Google’s servers. At first, this may seem a little alarming to you; there are obvious privacy concerns when that much information is being collected and passed along when you are browsing the net. Fortunately, Google has taken this concern so seriously that it is built into the very design of GA. Rather than collecting information about a specific user and tying that to their name, GA instructs its information to be sent anonymously. If I visit a site and check three pages, GA’s won’t collect information in the form of ‘Tim Marco visited your site three times’. Instead, it will simply tell the site that a user, using a specific keyword, browser, and from a certain region, visited their site three times.

Why does any of this matter?

There are two important takeaways from how GA collects information that should matter to any site owner.

The first is that, because it is written in Javascript, some users will always be invisible to GA. I mentioned earlier that Javascript is an almost-universal language, but the fact remains that some users either don’t have Javascript capability or actively turn off Javascript on their browsers. Modern computers, tablets, and smartphones pretty much all have Javascript capability installed by default. But although their numbers are dwindling, there are still a fair number of older systems still in use that don’t use Javascript, and as a result, they will never show up in Analytics reports.

Likewise, some more advanced users can change their settings to prevent Javascript from ever affecting their browser (typically due to either privacy or performance concerns). So if for whatever reason you need to have fully accurate information of exactly how many times your site has been accessed, GA  is not going to cut the mustard. Or, if you have reason to believe that your site might have an audience that is heavy on either end of the savvy spectrum (either using outdated technology or completely customizing their computers), GA might miss a large segment of your traffic. If you are concerned that this is the case with your site, you should probably look into a server-log based solution to supplement your site tracking.

The other important takeaway is that because it uses anonymous tracking, GA doesn’t allow you to deeply track user-level interaction. For some sites (especially those that require users to sign up and log in), it might be important to know a lot about how individual users traverse from page to page, or how one session differed from another. While you can get some of this information from a default GA setup, it can be much more difficult to track users who, for example, might use a single login from multiple devices. In such a case, it might be worthwhile to look into a solution such as Piwik.

How important are the limitations of Google Analytics?

All in all, the two limitations I’ve mentioned aren’t really major drawbacks for most sites. There are plenty of reasons why the software is used by half of the world’s leading websites.