đ„ Metrics Monday Web Analytics Series
My initial vision for Metrics Monday didnât include multi-week series, but as I considered it furtherâ especially in the case of web analyticsâââthe concepts and terminology related to many metrics build on more fundamental concepts, so thereâs an implicit order to best presenting an introduction to them. To that end, Iâll be writing about web analytics for the next 12 weeks or so.
đŠWeb Traffic: Pageviews, Users, and Sessions
The first few metrics weâll tackle are measures of web trafficâââpageviews, users, and sessions.Â
Google Analytics dominates the website performance data collection space, unsurprisingly, with their free service, but there are a lot of other platforms doing the same task from powerhouse Adobe Analytics to small-but-mighty Y Combinator-backed Mixpanel.
Iâll use terminology consistent with Google Analytics definitions unless otherwise stated (because itâs ubiquitous, not necessarily because itâs âbetterâ than other platforms).Â
đ Pageviews: Counting is hard.
In my career as a data practitioner, across companies and industries, Iâve consistently found that the metrics that seem the simplestâââspecifically the ones involving counting somethingâââcan be the hardest to pin down. Why? There are several factors, but Iâm convinced that a big one is that weâas business units and individual contributorsâall think we know the definition of some very foundational concept, like what a âcustomerâ is, and go about analyzing data accordingly. At some point, we realize the business intelligence teamâs numbers donât match the customer success teamâs, whose donât match the finance teamâs or the marketing teamâs.
As you probably intuited, pageviews (or page views, if you prefer) is a measure of the number of views of a webpage. It sounds straightforward, but there are some nuances, and you must proceed with a definition. In writing. That everyone in your organization knows about and can access. Trust me regarding the need for agreed-upon definitions of common metrics if you trust me about nothing else again, ever. I promise that defining something is alwaysâââand I very, very rarely say âalwaysââââbetter than not defining it. Having a consistent, agreed-upon, written-down definition will save you time, effort, and unnecessary meetings, andâââmost importantlyâââwill enable a trusting relationship between you, the data practitioner, and everyone else at your organization.Â
Should we count several views of the same page by the same user in quick succession as separate pageviews? How do we define âviewsâ? What interval of time do we consider âquick successionâ?
Questions like these, questions asked by data teams everywhere, are the reason you must have a well-defined, well-documented metric before you implement dbt or a data mesh or a lakehouse or whatever shiny, new component of the Modern Data Stack gets prioritized above all else at your company.
Letâs take a look at the Google Analytics definition of pageviews found in the Google Analytics Help Center Glossary:
A pageview is an instance of a page being loaded (or reloaded) in a browser. Pageviews is a metric defined as the total number of pages viewed.
By Googleâs definition, the pageviews metric doesnât involve who the viewer is or when they do the viewing, so to answer one of the questions posed previously, we should count our multiple views by the same viewer in a short timeframe as distinct pageviews.
đ But wait. Google Analytics provides a more detailed definition* in an article titled âThe difference between Google Ads Clicks, and Sessions, Users, Entrances, Pageviews, and Unique Pageviews in Analyticsâ (đ€Żwhat a mouthful!), also in the Help Center:
A pageview is defined as a view of a page on your site that is being tracked by the Analytics tracking code. If a user clicks reload after reaching the page, this is counted as an additional pageview. If a user navigates to a different page and then returns to the original page, a second pageview is recorded as well.
So this involves tracking code. How do we know if the site our viewer visited is being tracked?Â
The Google Analytics developerâs guide definition is technical, obviously, but succinct. It tells us exactly which sites will be tracked and counted in Google Analytics pageviews.
There are two ways to send a pageview to Google Analytics:
1. Use the default behavior of the
gtag.js
snippet2. Send manual
page_view
events
Iâll translate the two most technical aspects of the definition:
A
gtag.js
snippet is a short bit of code written in JavaScript, the language of the web.ÂA
page_view
event is a replacement for the aforementioned snippet of JavaScript. It tells Google Analytics NOT to count pages the way it does by default, but to count the pages we want to count, the way we want to count them. (Disclaimer: This definition is not technically 100% accurate, but for the sake of non-developersâ understanding it does accurately reflect the purpose of thepage_view
event.)
Adobe Analytics documentation defines pageviews similarly, and so do other platforms Iâm familiar with.Â
We went down the long and winding road of Google Analyticsâ definition of pageviews in order to understand that the numbers you send to stakeholders in reports and display in data visualizations could be very wrong without the knowledge that the software development team possesses the most accurate definition of this metric. As a data analyst having just made this discovery, my next move would be to contact a member of the dev team to ask where to find the documentation related to this metric. Most companies have probably chosen to stick with Googleâs defaults, but some definitely have not. The accuracy of your web traffic metrics depends upon knowing for certain how your company defines pageviews.Â
Finally, after a long journey into semantics, hereâs the calculation:
SUM(Pageviews)
The mathematics is easy for this one, but getting it right is hard.