What is Google Analytics and how does it work?

Google Analytics is a free website analytics software that measures the traffic to, and activity within a website or online application. It functions through a combination of Cookies and JavaScript.

Visit Google Analytics

The Google Analytics tracking code is a snippet of JavaScript code that is added to every page of the website or application. The tracking code then runs in the visitor’s Internet browser when the visitor browses the website (providing JavaScript is enabled within the browser). It anonymously collects the visitor’s data and sends it to a Google data collection server.

As well as transmitting information to the Google server, the tracking code sets a first party cookie (providing cookies are enabled in the browser) on each visitor’s computer. This cookie stores additional anonymous information that allows Google Analytics to determine such factors as:

  • Whether the visitor is new or returning
  • The timestamp of the visit
  • The traffic source that directed the visitor to the website e.g. search engine, referral site, social media etc.

Why use a web analytics tool?

By regularly reviewing the historical visitation, activity and behavior trends of visitors to our websites, we can better understand how people are really interacting with our site, and make informed, strategic and results-focused marketing decisions.

What prevents Google Analytics from tracking data?

If JavaScript or Cookies are disabled within the browser, Google Analytics cannot operate, and will not collect any data from that visitor’s session. Ad blocking programs can also disable Google Analytics, preventing data collection.

Privacy networks can also mask users’ locations, which create inaccuracies in geographical data.

All of these factors can prevent some visitors and activity from being tracking, leaving some gaps in the data.

However, these limitations are considered to be small, affecting only a small portion of visitors. These limitations also affect the majority of web analytics software, as most operate using JavaScript and Cookies.

With this in mind, it is important to understand that while Google Analytics data isn’t 100% thorough and accurate, it can be the best understanding we have about our websites’ visitation and activity.

So rather than thinking of it as specificallywhat has occurred on the website, it provides valuable information about website trends, by using data sampling.


The practice of selecting a subset of data from your traffic and reporting on the trends detected in that sample set. Sampling is widely used in statistical analysis because analyzing a subset of data gives similar results to an analysis of a complete data set, but can produce these results with a smaller a computational burden and a reduced processing time.

Why can Google Analytics data vary from other website analytics data?

Website platforms that allow you to build and host websites on their server (rather than you selecting your own independent hosting), such as WordPress.com, Weebly, Wix and Squarespace, offer their own website visitor statistics, which often varies from that provided by Google Analytics. This is due to a different tracking method.

This data is generated based on the number of impressions – or how many times the pages are loaded and viewed – and page refreshes are counted as new visits or views. This is why these statistics often show a higher number of “visitors” than Google Analytics.

These statistics are also gathered based on server activity, and so are limited with what information they can collect about a visitor. The combination of cookies and JavaScript that Google Analytics (and other tools) use, allows a more accurate understanding of individual website “sessions”, and more details about the visitor and their activity on the website.

The main benefits of Google Analytics include:

  • Free to use
  • Relatively basic implementation
  • Well documented
  • Integrates easily with other Google products (Search Console, Google Ads etc)
  • Easy data exports as PDF, Excel or to Google Sheets
  • Easily connects to other tools, e.g. dashboard tools
  • Regularly updated

Next lesson: How to set up and install Google Analytics