DEV Community

Jean-Rémy Duboc
Jean-Rémy Duboc

Posted on

Dimensions, metrics and scope in Google Analytics: a quick recap

Google Analytics enables the analysis of many things on our site. To get the best out of Google Analytics reports, you must first understand two essential concepts: dimensions and metrics. They are everywhere.
It is also necessary to understand the concept of scope (scope), an key idea, which changes radically with GA4.
Quick recap.

A few definitions

Dimensions

A dimension in Google Analytics is an attribute given to a piece of data. This attribute allows us to describe or contextualize the data and analyze it.
To understand, we can illustrate with examples:

  • For a web page, dimensions could include: page URL, page name, author, date published, etc.
  • For a "click" type event, the dimensions can include the name of the page where the click occurs, the type of action linked to the click (form submission, adding a product to the cart, etc.), etc

Image description

Metrics

A metric is a quantitative (numerical) measure, related to a dimension. A metric can represent a quantity, percentage, time frame, etc.
A few examples to illustrate:

  • The time spent on a page, measured in seconds. In this scenario, the dimension is the page name or URL, and the metric is time spent.
  • The number of clicks on a specific Call to Action (CTA) button
  • The number of users from a particular country

Image description

Scope

Finally, we have to talk about the scope of dimensions and metrics. It's a bit of a complex idea, but it's crucial if you want to understand reports on Google Analytics, and to create custom metrics and dimensions.
Scope in Google Analytics describes what our dimension or metric applies to. Is a dimension specific to a user, or can it be linked to a particular event, or a session ?

Image description

For instance, if we are interested in a dimension relating to a click, say the URL of the clicked link, our "URL" dimension will have the scope "event" (or "hit" in Universal Analytics), because it applies to each event of the same type. In other words, Google Analytics will record a value for this dimension, associated with each event of type "click".

On the other hand, if we are interested in the age of our user, there is no need to link this dimension to every single event recorded on our site. This metric therefore has a "user" scope.

Changes to scope in GA4

One of the crucial differences between Universal Analytics (UA) and Google Analytics 4 (GA4) is a new way of thinking about the scope of dimensions and metrics.

In UA, we have 4 different scopes:

  • hit
  • Session
  • User
  • Product

GA4 simplifies things with just two scopes:

  • Event
  • User

Let's see how this change affects the way we think about our dimensions.
If we look at the browser used by our user, things get somewhat more complicated.
On the face of it, it's useless to associate this dimension with each event recorded on our site. As our visitor's browser remains the same throughout a session, in Universal Analytics this dimension has, quite logically, the "session" scope.

Image description

This dimension will be recorded for each user session in UA.

On the other hand, in GA4, notice that there is no "session" scope. The notion of session still exists in GA4, but it is computed very differently. GA4 logs all data as events, and groups events into sessions automatically (see this documentation page for details) .
GA4 therefore records this "browser" dimension with each event, and then groups the data by session.

What about the "product" dimension? It is also integrated into events (let's not forget: in GA4 everything is based on events). You will need to create specific ecommerce events to create the equivalent of your product scope dimensions and metrics in Universal Analytics on GA4. It's a vast subject, but the Google documentation explains it very well.

Top comments (0)