Matt Lane

Archives


Categories


Meta


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?

Matt LaneMatt Lane

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.

A diagram showing a website being transferred to a user's computer, and then Google Analytics data being sent from the user's computer to the Google Analytics servers in the cloud
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:

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

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:

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 Lane
Author

banging rocks together