• Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login

December 8, 2022

Custom metrics in Google Analytics 4

Updated: December 8th, 2022

If you have tried configuring Google Analytics 4, you should already be familiar with custom dimensions. Any custom text parameter that you send to GA4 (and that you want to use in the reports) should be registered as a custom dimension.

But you can also customize your setup by sending custom metrics. What are they, and how can you configure them?

In this blog post, I’ll share the steps on how to configure custom metrics in Google Analytics 4.

First, let’s start with some theory, then dive into the practical stuff.

 

Table of contents

+ Show table of contents +

  • What are dimensions in Google Analytics?
  • What are metrics in Google Analytics?
  • A number can also be a dimension
  • Examples of Custom Metrics
  • How to configure custom metrics in GA4?
    • #1. Update the GA4 event tag
    • #2. Test the tag
    • #3. Register custom metric in GA4
    • #4. Publish changes in your Google Tag Manager container
  • Using Custom Metrics in GA4
  • Final words

 

 

What are dimensions in Google Analytics?

To quickly understand the concept of metrics, first, let’s take a quick look at dimensions.

Dimensions are attributes. They describe something, e.g. a user, page, purchase, some other events, etc. To give you a clearer picture, here are some examples:

  • Page URL: https://www.example.com
  • Traffic source: google.com, analyticsmania.com
  • Coupon code: SUMMER20, BFCM21
  • Item category: apparel, shoes
  • User country: United States, Lithuania

But what if you want to count something? For example, how many pageviews did we get last month? How much money did we earn last week? That’s where the metrics come in.

 

What are metrics in Google Analytics?

Metrics are quantitative measures. They allow you to count and measure things (this sounds so vague, but please, bear with me). With metrics, you can know how often the X happened, how much you got of Y, etc.

Here are some examples:

  • Order total: 99.99
  • Event count: 247
  • Number of logins: 32
  • Number of purchases: 4
  • Product price: 19.99

Dimension lets you know WHAT kind of product was purchased, but thanks to metrics, you can know HOW MANY times the product was purchased, what is the product’s revenue, etc.

If we take a look at the report in Google Analytics, here’s the relationship between metrics and dimensions.

 

A number can also be a dimension

If you think that a number is always a metric, that isn’t always true. Sometimes, a number can be a dimension too. Here’s an example. You have implemented scroll tracking that measures how often your visitors scroll past certain page height thresholds.

Those thresholds are 25%, 50%, 75%, and 90%. Let’s take a look at the report done with the Exploration report.

On the left side, we have a dimension called Percent Scrolled. On the right, we have the Event Count metric.

Even though the values on the left look like numbers, they are actually dimensions. They describe scroll thresholds that we track. There are 4 possible values in total.

And on the right side, we see how many times each threshold was reached.

 

Examples of Custom Metrics

Even though Google Analytics 4 has a bunch of built-in metrics, they do not cover all possible scenarios. Analytics tools are built to cover many general use cases, but they will never adapt to your business’s uniqueness out of the box.

You have to customize.

You can send custom dimensions, and you can also implement custom metrics. Here are some examples of custom metrics in Google Analytics 4 that you can implement:

  • Number of videos views
  • Number of form submissions
  • Total discounted amount of purchases

Sure, you could know the number of video views by counting how many times the video_start event occurred and have a report like this:

In the screenshot above, the dimension is Event Name, and the metric is Event count.

But what if you wanted to see a report where you can have the number of form submissions and video views per page? Like this:

It would be much easier to create this report with custom metrics Video Views, and Form Submissions. But Google Analytics 4 does not offer these metrics by default!

That’s where we could utilize custom metrics.

 

How to configure custom metrics in Google Analytics 4?

In this example, I will show how to get the Video Views metric in Google Analytics 4. First of all, answer this: what is a Video View?

Some might say that it is the number of times when visitors start to watch a video. Others might be more selective and say that we should track a video view only if a visitor watches at least 10 seconds of the video.

There is no correct answer here. It depends on the business goals and who collects/analyzes this data.

For the sake of simplicity, let’s say that every time a “video_start” event is sent to GA4, we want to count this as a Video View and increment that metric by 1.

And that’s exactly what we should do. We should create a GA4 event tag that sends the video_start event together with a Video View metric (of which value is 1). Then GA4 will take that “1” and use it in the reports.

 

#1. Update the GA4 event tag

Let’s say that I already have created a Youtube trigger with the following conditions (this is just for the Start event):

 

Then I will use that trigger to fire a tag with the following settings (note: all those GTM variables are built-in, so make that you enable them in Variables > Configure):

This tag fires on the aforementioned Youtube video trigger.

It’s very important: this tag fires ONLY when the video_start event is sent. If you also want to track other interactions (like video_progress or video_complete), use a separate tag + trigger (but without the metric).

To include the custom metric in the tag, we have to add one more parameter to the tag. You can name it whatever you want, I’ll call it video_view and set its value to 1. This means that every time we fire this tag, that metric in GA4 will be increased by 1.

Save the tag.

 

#2. Test the tag

Enable/refresh the GTM Preview mode and go to your website, where the embedded Youtube video player is located. Start playing the video.

In the Preview mode, an event called a Youtube video should appear. Click it, and you should see the GA4 event tag fired.

Now, go to Google Analytics 4 Debug View. You will find it at the bottom left corner of the GA4 interface. Find your device, and there you should see the video_start event. Click it and then expand the video_view parameter. Its value should be 1.

 

#3. Register custom metrics in Google Analytics 4

Go to Google Analytics 4 > Admin > Custom Definitions > Custom Metrics > Create Custom Metrics.

Then enter the following conditions:

  • Metric name: Video views (can be named whatever you want)
  • Scope: Event
  • Description: This is optional. You can leave it empty.
  • Event parameter: video_view (enter it exactly as you configured it in the GA4 event tag in GTM)
  • Unit of Measurement: Standard

Save the metric.

A standard unit of measurement means a regular integer.

In some cases, it might make sense to have the Currency as the unit of measurement. For example, you send the purchase event every time someone purchases on your website. Together with that event, you also send parameters like value (e.g. 99.99) and coupon (e.g. SUMMER20). But together with that event, you could also send the size of the discount (e.g. 20.00). To do that, you could send a custom parameter discount_value and then register it as a currency custom dimension.

There are also other units of measurement like feet, miles, seconds, etc.

 

#4. Publish changes in your Google Tag Manager container

Don’t forget to publish your changes so that this change would go live to all of your visitors/users. Click the Publish button at the top-right corner and follow all the steps.

After you do it, wait till the next day, and the metric will be ready to use. In total, it might take up to 24-48 hours. So don’t start worrying too soon.

 

Using Custom Metrics in Google Analytics 4

Here is an example of where you can see/use that Video Views custom metric in Google Analytics 4.

Go to Explore > Free Form Exploration (or Blank).

Then enter the following configuration.

Variables tab:

  • Add Page path as a dimension
  • Add Video Views as a metric

Tab Settings tab:

  • Add the Page path in the Rows section. Remove any dimension that was prefilled there.
  • Add Video Views in the Values section. Remove any other metrics that are there

And then, you will see a report that looks like this. On these pages, there is an embedded youtube video player embedded, and I can see how often those videos are played.

In fact, I could go even further and create another metric for page views and have it in the same report. Although, it would be nice that such a basic thing as the Page Views metric would be available by default.

If you want to learn more about how to use the Exploration report, read/watch this.

 

Custom Metrics in Google Analytics 4: Final words

And here, we have reached the end of this fairly basic overview of custom metrics in Google Analytics 4. We have learned that:

  • Metrics are quantitative measurements that let us count/measure (while dimensions describe items, users, products, pages, etc.)
  • You can send custom metrics to Google Analytics 4 by including them in GA4 tags (within GTM).
  • You have to register custom metrics in Google Analytics 4 if you want to use them in reports

 

Julius Fedorovicius
In Google Analytics Tips
9 COMMENTS
Naveen
  • Apr 5 2021
  • Reply

Hi Julius,

Thanks a lot for this insightful article.

Here I am having a doubt in Custom Definitions ---> Custom Metrics ---> New Custom Metrics ---> Event Parameter called "page"

Screenshot for your reference --> https://imgur.com/a/WNWhiy8

What is the usage of "page"

Can I use this to create a custom "page_view" metric and track this in the Analytics hub?

Thanks a lot in advance!

Carlos M. Díaz Honrado
  • Nov 2 2021
  • Reply

Hi Julius,
In this case, you can create this metric from the GA4 «Video engagement» Enhanced Measurement event.
It would simply be enough to modify the video_start event by adding the video_view metric and the value 1 in Configuration > Events> Modify Events.
Gives the same result
Happy Tuesday.

    Julius Fedorovicius
    • Nov 5 2021
    • Reply

    Good point. Never tried it but this makes sense.

Ketan
  • Jul 28 2022
  • Reply

Thoughts on how to use custom metrics to count only once per session/user? If these pivot off of an event firing, refreshing the page and the like could over-inflate values for things that really should count just once per session (like a quote, form submission, etc). Can't see any clean way of doing this. Thanks!

Sparsh
  • Dec 15 2022
  • Reply

Hello Julius, could you please answer the below questions?
Can I use the event parameter from my purchase tag as a custom metric? If yes, then why the custom metric is not showing any value as it's been more than 24 hours since I created it? Do I need to change the unit of measurement to standard?

Screenshot: https://imgur.com/a/83pikgb

Thank you.

Julien
  • Jan 23 2023
  • Reply

Hi Julius,

I bought your premium training and it's amazing.
I have a question related to custom metrics.

If I create 3 events in GTM to track this in GA4:
- specific mail clicks
- external websites link clicks
- specific ads clicks

Could I just create 1 custom metric called for example "total_click" and push it as a parameter on these 3 events ?

The idea is then to create one custom reports with total clicks event by event (for these 3 events) and the grand total on the side.

Thanks a lot for your help.

    Julius Fedorovicius
    • Jan 23 2023
    • Reply

    If you want to combine those clicks to into a single number, then yes. Your approach is correct.

Alison
  • Feb 1 2023
  • Reply

Hey Julius,

Do we know of any way to create custom calculated metrics in GA4 or is this only a GDS feature?

    Julius Fedorovicius
    • Feb 2 2023
    • Reply

    You cannot create calculated metrics in GA4. I don't know if that feature will be added in the future.

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Introduction to Google Tag Manager Server-side Tagging
  • 3 Ways to Pull Data from Data Layer with Google Tag Manager
  • Cannot See the Google Tag Manager Option in Google Ads Conversion?
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings