Google Analytics Basics: Users, Sessions & Pageviews


If you work with websites at all, you have probably seen reports from Google Analytics detailing how your site, or some part of your site, is performing in terms of users, sessions and pageviews. Maybe you even produce such reports for others. But what, really, do those numbers mean, and how accurate are they?

You can think of Users, Sessions, and Pageviews as nested elements of each other: Users have sessions, and each session has pageviews.

Chart showing a how pageviews are nested inside sessions and sessions inside users

Let’s take a look at a visit from an actual user—let’s call him Frank—and see how Google Analytics counts his interactions with your site. Frank has never been to your site before, but yesterday looked at your homepage, then clicked a link in your navigation menu to go Page 2, clicked another link to go to a Page 3, then went back to Page 2.

Frank goes from Home to Page 2 to Page 3 and then back to Page 2

We can visualize Frank’s trip through your site like this:

Translating this visit to your site into Google Analytics numbers, this is what Frank added to your reports:

  • One user (Frank himself)
  • one session
  • four pageviews (three unique pageviews)

Google Analytics counts each user and session by using cookies—small bits of text browsers write onto a computer’s hard drive that record information about any past activity on a site.

Users

Frank has never visited your website before. So when Frank’s browser loads the first page of your site, the Google Analytics javascript looks to see if the browser already has a User cookie from a previous visit. If there is no user cookie, the browser creates one, assigning a unique number, or Client ID, to this user, that looks something like this: 1748447953.1518541752.

This cookie will expire after two years of inactivity. If Frank visits your site once again, more than two years after his first visit, he’ll be counted as a new user. But if he visits even once before two years have elapsed, Google Analytics will see the preexisting user cookie, count him as a returning user, and add another two years to the user cookie’s expiration date.

Sessions

When Frank loads the first page of your site, the Google Analytics javascript will also look for a session cookie. Just as user cookies group different visits together, session cookies group together visits to individual pages. By default, session cookies expire after 30 minutes of inactivity on your site, or at midnight. (You can adjust the session length in your Google Analytics admin, if you want, but most people just leave it at 30 minutes.)

So let’s say Frank goes to your site, then goes to get lunch but leaves his browser open at your homepage, and doesn’t come back for another 35 minutes. When he gets back and clicks to visit another page on your site, it will be counted as the beginning of a new session, because the first one will have expired.

Conversely, if Frank gets really absorbed in your site and spends three hours clicking from page to page, all of that activity will be recorded as part of a single session. Unless Frank’s marathon visit extends past midnight, in which case the session cookie will expire and a new one will be created. The session cookie will also expire if Frank spends more than 30 minutes looking at a single page, without clicking to visit a new page. The session cookie is only renewed when new data is sent to Google Analytics, and usually that’s only when a new page is loaded.

Google has a more detailed explanation of how sessions are counted, if you’re interested.

Pageviews and Unique Pageviews

A new pageview is recorded whenever a page with the Google Analytics javascript loads in the browser. This includes when the current page is reloaded, or refreshed. Let’s say Frank visits your homepage, then refreshes the page six times to see all of the randomly-loaded background images, or something. Google Analytics will count that as eight pageviews, even though Frank is just looking at the same page over and over again.

Unique pageviews are way to get around this double-counting. A unique pageview counts pages viewed at least once during a session. So, Frank’s refreshing the page over and over again will create eight pageviews, but just one unique pageview.

How accurate are these numbers?

In short, not very accurate, but probably good enough as estimates of your actual users’ activities and how they are changing over time. Relying on cookies to track users and sessions has some serious flaws.

First of all, cookies are browser and device specific. If Frank visits your site on his laptop computer, then on his phone, and then later on his work computer, he’s counted as three users. Similarly, if he uses different browsers on the same machine, he’s counted as a different user for each. Use of multiple devices and multiple browsers like this can systemically inflate your user and session counts.

Some users may routinely erase their browser’s cookies as well, which will also inflate your user and session counts. If Frank clears his browser’s cookies, the next time he visits your site he will be counted as a new user with a new session. No one knows exactly how many people routinely delete their cookies, and how often they do so. But the usually-cited figure, based on a study by Comscore in 2006, is that “3 in every 10 Internet users delete their cookies in a month.”

Some unknown number of users employ ad-blockers or disable javascript in their browsers, which can mean that their visits to your site aren’t captured at all by your analytics.

All these sources of inaccuracy (and there are more, too) don’t mean, however, that your Google Analytics numbers are meaningless. The count of users and sessions from your analytics dashboard almost definitely does not equal the number of actual people who are using your site, and the number of times they visit. But if you consider that the sources of inaccuracy are largely constant from site to site, and from month to month, then your analytics numbers are a roughly accurate gauge of your site’s performance relative to other sites and time periods. So they are still useful for comparing one site to another, and one month or year to another.