An idiot’s guide to Google Analytics

So you’ve heard of Google Analytics, but you don’t really understand what it is, or how it works?


What is Google Analytics?

Google Analytics is a free tool that lets you monitor and analyse website traffic. It is the most widely used website statistics service globally (In 2009, 50% of websites contained some kind of traffic analysis tool. Of that 50%, 80% were using Google Analytics).

How does Google Analytics work?

Google Analytics works via a “page tag”. The page tag is called the “Google Analytics Tracking Code”, and it is a snippet of JavaScript code.

Imagine that this is that script snippet:

<script>
THIS IS THE SCRIPT
</script>

A website owner adds this code to every page of their website that they would like to track.

Here is the source code of a fictional webpage without the tracking code:

<!DOCTYPE html>
<html>
WEBSITE WEBSITE WEBSITE
WEBSITE WEBSITE WEBSITE
WEBSITE WEBSITE WEBSITE
WEBSITE WEBSITE WEBSITE
</html>

This is the source code of the same simple webpage with the tracking code added:

<!DOCTYPE html>
<html>
WEBSITE WEBSITE WEBSITE
<script>
THIS IS THE SCRIPT
</script>

WEBSITE WEBSITE WEBSITE
WEBSITE WEBSITE WEBSITE
WEBSITE WEBSITE WEBSITE
</html>

Now, when someone visits the website (and they have Javascript enabled [let’s say ~98%*]), the tracking code runs in the visitor’s browser, collects visitor data, and sends it to a Google data collection server.

The usage data is then stored in Google’s data collection server.

How can I tell if a website is using Google Analytics?

As mentioned above Google Analytics is included via a page tag. You can view the source code of any webpage on the World Wide Web using your browser. Once you are looking at the source code of a webpage, you can check for the Google Analytics code.

To do this:

  1. Load the website you want check
  2. View the source code of the webpage by pressing Ctrl + U
  3. Search the source code by pressing Ctrl + F for “analytics.js” or “ga.js” or “googletagmanager.com”

If you find “analytics.js” or “ga.js” or “googletagmanager.com” in the source code, the webpage is tracking usage with Google Analytics*.

Can I view the analytics for the website?

Access to the analytics being collected for any particular website is limited to those who have login access to the Google Analytics account.

If you are an employee of an organisation, and want access to your own organisation’s analytics, you can try asking your IT department (or whomever looks after your analytics) to grant you access. If they want to grant you access, it is an easy job.

What data does Google Analytics collect?

Google Analytics can collect a lot of data about how people use a website. At its most basic, it will collect:

  • Time of visit, pages visited, and time spent on each page of the webpages
  • Referring site details (such as the URI a user came through to arrive at this site)
  • Type of web browser
  • Type of operating system (OS)
  • Flash version, JavaScript support, screen resolution, and screen color processing ability
  • Network location and IP address.

With some custom implementation, Google Analytics can also be used to collect additional data which might include:

  • document downloads
  • clicks on links leading to external websites
  • errors when users fill out forms
  • clicks on videos
  • scroll depth
  • interactions with site-specific widgets.

Google’s latest version of Google Analytics (Universal Analytics) can be used to track even more stuff — it isn’t limited to websites. It could track:

  • app activity
  • telephone conversations
  • Point of sale transactions
  • RFID or NFC sensor activity
  • a whole lot of stuff that no one has thought of yet.

Privacy

Google Analytics Terms of Service prohibits the collection of personally identifiable data such as name, email address, or billing information.

If you are curious, you should check a website’s privacy policy to see what data they are collecting about you.

Assigning user IDs and cross device measurement

While you cannot collect personally identifiable data in Google Analytics, you can assign IDs (perhaps a customer ID) to multiple sessions across multiple devices.

From Justin Cutroni: “The User-ID value must originate from your systems. It must eventually appear in the tracking code on your site or in your app. The User-ID will then be sent to Google Analytics with each data hit.” Image from http://cutroni.com/blog/2014/04/10/understanding-cross-device-measurement-and-the-user-id/

In turn, this new Google Analytics data can then be exported and correlated back to existing customer/client data outside of Google Analytics.

For a deeper explanation of all of this stuff, check out Justin Cutroni’s Understanding Cross Device Measurement and the User-ID.

How can I stop Google Analytics collecting data about my activity?

If you want to stop websites collecting website usage data about you via Google Analytics, you can:

  1. disable cookies in your browsers
  2. disable Javascript in your browser
  3. use Google’s Opt-out browser add-on
  4. use a third-party tool such as Disconnect, Ghostery or Do No Track Me

The first two options will affect your online experience (some features or functionality may not work).

How can I start tracking users on my website?

Google Analytics is free to use. All you need are:

  1. a Google account
  2. a website to track (and the ability to add the Javascript snippet to that website)

Find out more at http://www.google.com/analytics/



Matt works at Heyday in Wellington, New Zealand.
Occasionally he tweets:
@mattlane

If you like what you just read, please hit the ‘Recommend’ button below.