Google Analytics Advanced Course
Google Analytics Advanced Course
Introduction
Hi, I’m Justin Cutroni. And I’m Krista Seiden. We’re Analytics Advocates at Google. Welcome to
Advanced Google Analytics. If you’ve already taken our course Google Analytics for Beginners,
you should be well prepared to take this next step in your understanding of Analytics.
Let’s start by showing you some specifics on how Google Analytics collects data. Remember
that website data collection begins with a snippet of JavaScript tracking code that’s included on
every web page of the site where you want to collect data. The goal of the tracking code is to
track each user interaction that occurs on your website. These interactions can be as simple as
loading a page or something more specific like clicking a video play button or a link.
The Analytics tracking code uses the domain of the website you are tracking to define it as a
“site” in your reports. With the tracking code installed, Google Analytics will drop a cookie in
the user’s browser for that website and any related subdomains. This makes it easy to track
traffic on a single website URL domain or subdomain by default.
Note that if you install the same default tracking code on pages with different domains,
Analytics will count these users and sessions separately. If you need to track users across
different domains, you will need to set up cross-domain tracking, which we’ll discuss later.
Anatomy of a "hit"
With each user interaction on your website, the Analytics tracking code sends what’s called a
“hit” to Google Analytics. A “hit” is a URL string with parameters of useful information about
your users. It looks something like this:
If we break down the URL string, you can see that it’s passing some useful information to
Analytics about the user that triggered the hit. For example, we can see things like:
A “pageview” hit is triggered when a user loads a webpage with the tracking code. This is the
most common type of hit sent to Analytics. Every time a user opens a page with the tracking
code, a new pageview hit will be sent.
An “event” hit lets you track every time a user interacts with a particular element on your
website. For example, you can track whether users click a video Play button, a particular URL, or
a product carousel. Event hits pass four parameters of data in the URL: event action, category,
label, and value. You can use these to categorize interactions in reports that are specific to your
website. We’ll go into more detail on event tracking a little later.
A “transaction” hit (also called an “ecommerce” hit) can pass data to Analytics about
ecommerce purchases such as products purchased, transaction IDs, and “stock keeping units”
(or SKUs).
If you’ve set up Enhanced Ecommerce within Google Analytics, you can also pass additional
ecommerce data like product category, whether items have been added or removed from a
shopping cart, and how many times users viewed a product on a website.
There are additional hits such as “social hits” that can pass likes, shares, or tweet data; and
“page timing hits” that allow you to report on page timings, but the Pageview, Event, and
Transaction hits are the three most common.
We’ve discussed some of the information passed in hits such as Language and Page Title. But
Google Analytics widens that data using other sources such as IP address, server-log files, and
other ad-serving data. Using this additional information, Analytics can understand things like:
1. a user’s location; 2. specifics about their browser and operating system; 3. their age and
gender; 4. and the source/medium that referred them to a site.
You’ll recognize many of these parameter names passed in the hit or widened with additional
data because they get turned into the dimensions that make up your reports in Google
Analytics. Remember that dimensions are just ways to categorize metric data like all the metrics
for a specific “country” or “device type.”
Once the hit is sent to Google Analytics and combined with additional data, all of this
information is ready for processing by the Analytics servers. Understanding how Analytics
collects and processes data can help you better understand your reports and what the data
means.
1.2 Categorizing into users and sessions
Let’s look at the first few steps in which Google Analytics processes data.
In the first step, Google Analytics differentiates new from returning users. When a
user arrives on a page with tracking code, Google Analytics creates a random,
unique ID that gets associated with the user’s browser cookie. Analytics considers
each unique ID to be a unique user. Every time a new ID is detected, Analytics
counts a “new user” and sends it over with the hit. When Analytics detects an
existing ID, it sends a “returning user” value with the hit.
Defining Sessions
Let’s look at a few examples of how hits can be organized into sessions.
For our first example, If a user visited the homepage of the Google Merchandise
Store and then left immediately without clicking on anything, Google Analytics
will record one “pageview” hit for that user in a single session.
But let’s take a look at a second example: A user lands on the homepage of the
Google Merchandise Store. The session begins with a “pageview” hit. Then the
user clicks the play button for a video that is being tracked with event tracking.
This triggers an “event” hit. Google Analytics will record two hits for that user in
that session: a “pageview” hit for the home page, and an “event” hit for clicking
the play button.
In a third example, a user visits the store and lands on the homepage. They
immediately open a new tab in their browser to view another website and they
spend more than 30 minutes on that site. Then they go back to the tab with the
Google Merchandise Store and click the play button on the video. Google
Analytics will record two separate sessions for that user.
The first session will include a “pageview” hit and the second session will include
an “event” hit, since the first session will have timed out, while the user was
viewing the second tab.
While sessions time out after thirty minutes of inactivity by default, you can
change this setting in your configurations to better align with user behavior on
your site. For example, a site with a goal to get users to watch videos may not
want sessions to timeout after thirty minutes. They can extend session timeout to
the average watch time of the videos on the site. Click the link at the end of this
lesson to view instructions for changing the default session timeout.
Once Google Analytics has organized data by session, it can calculate a number of
the metrics that show up in your reports such as sessions, pages per session,
average session duration, and bounce rate.
The measurement protocol lets you send data from any web-connected device
like point-of-sale systems or web-connected kiosks to Google Analytics. Unlike the
tracking code which sends hits automatically, if you want to collect data from a
system outside of Google, you must pass the data collection hits manually in a
URL string.
The measurement protocol defines how to construct your hits using a customized
tracking ID and send those hits to your designated Google Analytics account. You
can find more information about the Measurement Protocol in the Analytics
Developer documentation linked at the end of this lesson.
Google Analytics can also link data from other Google marketing tools like Google
Ads, AdSense, or the Google Search Console.
This allows information like Google Ads clicks, impressions, and cost data to be
viewed in your Analytics account.
These are the first three steps Google Analytics takes when processing data.
Watch the next video to see how Analytics finishes processing data.