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 great advantage for site owners is its ease to set up. In just a few simple steps, site owners can 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.

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?

How Google Analytics works is by collecting information about site visitors. From a website’s traffic sources, to the number of hits per month, Google Analytics offers excellent insight into users behavior, and collects valuable user data in real time.

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. Meaning that without the help of a language like Javascript, an HTML page won’t let you interact with a site. For example, you couldn’t change text and your computer or communicate with a server.

Javascript gets around that limitation because it is a standardized language, meaning, 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. Data could include the specific web page that you are viewing, technical information about your computer, how you arrived at the site, or the way that you navigate the site.

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. This may seem a little alarming to you as there are obvious privacy concerns when that much information is collected 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. There are still a fair number of older systems still in use that don’t use Javascript. 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.

On the other hand, GA might miss a large segment of your traffic if your audience is either extremely savvy (using custom computers) or un-savvy (using outdated technology). 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’s important to understand how individual users move from page to page. It’s similarly important to know 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 whologin 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 Google Analytics limitations I previously 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.