About cookies on this site

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. Learn more

Cookie settings

About cookies on this site

Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. Learn more

Necessary

Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.

Preferences

Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.

Analytical cookies

Analytical cookies help us improve our website by collecting and reporting information on its usage.

Marketing cookies

Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.

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

October 16, 2024

How to Filter a Standard GA4 Report by Event Name

Updated: October 16th, 2024

Even though Google Analytics 4 lets you customize standard reports (in the “Reports” section), there are limits. One of the most annoying things is that not all dimensions are available to build a filtered report.

It’s simple to have a report based on a page hostname, page path, or something similar. But can you filter a report by event name? Nope. At least not yet.

 

Table of Contents

Here’s what you will learn in this article

  • Before we continue
  • The Workaround
    • #1. If you are using web GTM (without server-side GTM)
    • #2. If you are using server-side GTM
    • #3. If you are using GTAG (hardcoded GA4 snippet)
  • A method that did not work for me
  • Filter the report by the event name
  • Update. Modifying the URL of the GA4 report builder
  • Final words

 

Before we continue

Maybe Google has already fixed this issue (if you’re reading this in the future)? Go ahead and check. In Google Analytics 4, navigate to Reports and select, for example, the Events report.

Then, click “Add filter” and see if “Event name” is in the list of available dimensions.

If yes, then it’s good news. The workaround (explained in this article) is no longer needed. Just select the “Event name” in the list of dimensions, and you’ll be able to filter the report.

If no, then continue reading.

 

The Workaround

Let’s say I want to show the most popular site search keywords in a standard report. Normally, I would expect to have a filter that includes only those events where Event name exactly matches view_search_results.

Unfortunately, this is not possible. As a result, the report will look like this:

standard site search report in google analytics 4

The first row is empty because it includes all other unrelated events.

So, how can we filter a Google Analytics 4 report by event name? There’s a workaround.

P.S. I am pretty sure that this is an oversight of the GA4 team (although, it’s been like that for years now). Hopefully, they will add that dimension to the filters, but right now, here’s the workaround. A ridiculous one. But it works.

When you are sending an event to GA4, you should also send a custom dimension that contains the event name (because filters in standard reports let you filter by a custom dimension).

The technical details of the workaround depend on how GA4 is implemented. I will explain four options:

  1. If you are using GTM (without server-side GTM)
  2. If you are using server-side GTM
  3. If you are using Google Tag (hardcoded GA4 tracking code on your website)
  4. Update: a method that requires no customization in GTM or hardcoded tracking snippets. This is explained at the end of this blog post.

Please note that the first three options in this blog post are not retroactive. It will not apply to the data that you have already collected in the past. It will work only for the data collected after you implement this.

The 4th option was added later (after publishing this article). It’s a nice hack. So, before you try to implement any of the options right here, read the entire blog post first.

Subscribe and Get the Ebook - Mastering GA4 event tracking

#1. If you are using Google Tag Manager (without server-side GTM)

In Google Tag Manager, the setup would look something like this. You will need to update all event tags (one by one) with a parameter, say event_name_custom.

If you add this parameter to event tag “generate_lead”, then the same value should be added for the event_name_custom.

Do not add this change to the Google Tag (a.k.a. GA4 config tag) because it is responsible for multiple automatically tracked events (e.g., user_engagement). Also, this workaround will not work for Enhanced Measurement events (unless you are using server-side tagging. More on that – a bit later).

Publish the changes in the container.

After you have updated all GA4 event tags with a custom parameter (e.g., event_name_custom), register it as a custom dimension. Go to GA4 > Admin > Custom Definitions > Create custom dimension and enter the following settings:

After 24 hours, you can customize the reports and use the “Event name – Custom” dimension as a filtering condition.

Subscribe and Get the Ebook - working with reports in ga4

#2. If you are using server-side GTM

Things are more flexible if you are using SGTM, and this workaround will also apply to automatically tracked events (including Enhanced Measurement).

In your server-side GTM container, go to Variables > Configure. See if “Event name” variable is enabled. If not, click its checkbox.

This variable returns the name of the event.

Then, open your GA4 tag in the same container (if you have multiple GA4 tags, then you will have to repeat this change in all of them). In the “Event parameters” section, enter event_name_custom and select the “Event name” variable as its value.

Now, every time an event is sent to GA4, SGTM will add an event_name_custom parameter. Its value will be the name of the event.

Publish the changes in the container.

After you have updated all GA4 event tags with a custom parameter (e.g., event_name_custom), register it as a custom dimension. Go to GA4 > Admin > Custom Definitions > Create custom dimension and enter the following settings:

After 24 hours, you can customize the reports and use the “Event name – Custom” dimension as a filtering condition.

Subscribe and Get the Ebook - Server-side tagging

#3. If you are using GTAG (hardcoded GA4 snippet)

The workaround I’ll explain in this chapter has the same limitations as #1 (GTM without SGTM). The custom dimension will not apply to automatically tracked events (including Enhanced Measurement).

If you have installed Google Analytics with its native tracking code, then it should look something like this:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W6QB81P6Y6"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXX');
</script>

To track events, your developer has to follow the following syntax:

gtag('event', '<event_name>', {
  <event_parameters>
});

For example:

gtag('event', 'form_submission', {
  'form_name': 'newsletter form'
});

You will need to ask the developer to add a custom parameter to all gtag event commands. An example looks like this:

gtag('event', 'form_submission', {
  'form_name': 'newsletter form',
  'event_name_custom' : 'form_submission'
});

The value of event_name_custom must be the same as the event name.

After all gtag event commands have updated with a custom parameter (e.g., event_name_custom), register it as a custom dimension. Go to GA4 > Admin > Custom Definitions > Create custom dimension and enter the following settings:

After 24 hours, you can customize the reports and use the “Event name – Custom” dimension as a filtering condition.

 

A method that did not work for me

Initially, I thought that maybe I could use the “Modify event” feature in GA4. Then, the same method would apply to all situations regardless of how GA4 is installed (except the Measurement Protocol).

However, the custom parameter was never added to the events. I tried to do this by going to Admin > Events > Modify event and entering the following condition. My idea was to fetch the event_name parameter from the event and reuse it for the event_name_custom. Unfortunately, this did not work.

My guess is that GA4 limits the usage of the event_name parameter in the “Modify event” feature.

 

Filter the report by the event name

Let me show you an example of how you can modify a standard report by the event name. Once the custom dimension is registered and you have collected data for a while (at least 24-48 hours), go to Google Analytics > Reports > Library.

Let’s say you are tracking form submissions (event: generate_lead). With each event, you also send the form name (parameter: form_name). Let’s build a report where we will see only data of the generate_lead event, and the list will show data by form_name.

In the Library, click Create new report > Detail report > Blank.

Then, enter the following settings:

  • Dimensions: Form Name
  • Metrics: Event count, Total users
  • Filter: Event name custom exactly matches generate_lead

Click Save and give this report a name (for example, Form submissions).

Then, close the report builder and add the report to any library of your choice (so that the report would be visible on the left sidebar). I explain all these steps in this article.

 

Update. A quick hack: modifying the URL of the GA4 report builder

This tip came from LinkedIn, where Jakub Niżniowski shared a way that does not require changing anything in GTM or GA4 tracking codes.

In a nutshell, you will build a custom report (in the Reports section) and then slightly modify the builder’s URL. After that report is saved, the filter with the event name will persist (unless Google changes something drastically in the future that could break it).

In Google Analytics 4, go to Reports > Library > Create new report >  Create detail report > Blank.

Let’s say that we (again) want to build the report based on a generate_lead event, and we want to see top-performing forms (by Form Name dimension).

First, I will select a dimension (Form name. It’s a custom dimension that I had). Then I add metrics, e.g., Event count and Total users. So far, the report looks like this.

But we still have that (not set) value from all other events. Also, the event counts of form names are incorrect (because this GA4 property tracks form impressions, too).

So, how can we filter by the event name? Let’s add a dummy filter first. On the right sidebar of the report builder, click Add filter.

Then I usually select some built-in dimension, e.g., Country exactly matches Canada.

Click Apply. Then, the report will be updated. When this report is generated, the URL of the page (in the browser’s address bar keeps changing, too). For example:

https://analytics.google.com/analytics/web/?authuser=0#/pXXXXXXXX/assetlibrary/explorer/new?params=_u..nav%3Dmaui%26_r.explorerCard..dimensions%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..seldim%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..metrics%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..selmet%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..sortKey%3DeventCount%26_r.explorerCard..isAscending%3Dfalse%26_r..dataFilters%3D%5B%7B%22type%22:1,%22fieldName%22:%22country%22,%22evaluationType%22:1,%22expressionList%22:%5B%22Canada%22%5D,%22complement%22:false,%22isCaseSensitive%22:true,%22expression%22:%22%22%7D%5D&r=new-report

Please note that pXXXXXXX is a replaced property ID, e.g., p211577699. In this URL, there are two parts we’ll need to change: country and Canada (I highlighted them in bold):

https://analytics.google.com/analytics/web/?authuser=0#/pXXXXXXXX/assetlibrary/explorer/new?params=_u..nav%3Dmaui%26_r.explorerCard..dimensions%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..seldim%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..metrics%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..selmet%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..sortKey%3DeventCount%26_r.explorerCard..isAscending%3Dfalse%26_r..dataFilters%3D%5B%7B%22type%22:1,%22fieldName%22:%22country%22,%22evaluationType%22:1,%22expressionList%22:%5B%22Canada%22%5D,%22complement%22:false,%22isCaseSensitive%22:true,%22expression%22:%22%22%7D%5D&r=new-report

“country” is the name of the dimension that I used in a filter. Replace it with eventName. Then, replace “Canada” with the name of the event. In my case, that’s generate_lead. If your event name contains spaces (e.g., “form submission”), then replace spaces with %20. For example, form%20submission.

If we go back to my previous example, the final URL will look like this:

https://analytics.google.com/analytics/web/?authuser=0#/pXXXXXXXX/assetlibrary/explorer/new?params=_u..nav%3Dmaui%26_r.explorerCard..dimensions%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..seldim%3D%5B%22customDimensionsGroup2Slot40%22%5D%26_r.explorerCard..metrics%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..selmet%3D%5B%22eventCount%22,%22totalUsers%22%5D%26_r.explorerCard..sortKey%3DeventCount%26_r.explorerCard..isAscending%3Dfalse%26_r..dataFilters%3D%5B%7B%22type%22:1,%22fieldName%22:%22eventName%22,%22evaluationType%22:1,%22expressionList%22:%5B%22generate_lead%22%5D,%22complement%22:false,%22isCaseSensitive%22:true,%22expression%22:%22%22%7D%5D&r=new-report

Paste this modified URL to the browser’s address bar and hit enter. The page will reload, and the “Event name” dimension will be displayed in a filter.

Save the report and add it to the collection of your choice.

Technically, I could have just given you the final URL where you replace the GA4 property ID, but I wanted to show you the entire process.

 

Filter GA4 report by event name: Final words

Filtering GA4 reports by event name is a crucial feature that, surprisingly, isn’t readily available in standard reports (at least when I am writing this blog post). While this limitation is likely an oversight that Google will address in the future, the workarounds presented in this article offer practical solutions (for now).

Remember to check if Google has updated GA4 to include the event name as a filtering option. If not, these workarounds will continue to serve as valuable tools in your analytics toolkit.

Subscribe and Get the Ebook - 20 GA4 mistakes
Julius Fedorovicius
In Google Analytics Tips
4 COMMENTS
Adam Mothersbaugh
  • Oct 12 2024
  • Reply

Hey, Julius.

Thanks for another great blog post. I'm a huge fan of this method for creating custom event-specific GA4 Reports.

First, your event modification method most likely didn't work since "event_name" is technically a parameter, but not an event parameter.

This is the same reason creating an event-scoped "Event name" custom dimension will always have a "(not set)" value.

However, what can work is creating one event modification per custom event. Here's an example.
- If: "event_name" -> "equals" -> "link_click"
- Then: Add an "action" event parameter with a value of "link_click".

That being said, there is a limitation for this method. That is, this event modification does not work with the "first_visit" and "session_start" events.

As a result, if a user starts a session by generating a "link_click" custom event, then the "session_start" with inherit all the event parameters from that "link_click" event, including the "action" event parameter value.

    Adam Mothersbaugh
    • Oct 12 2024
    • Reply

    Correction:

    then the "session_start" event will inherit

      Adam Mothersbaugh
      • Oct 29 2024
      • Reply

      Hey, Julius.

      It looks like Google is rolling out an update to add an "Event name" dimension filter to Reports.

      I can now use that filter in my GA4 Property's Reports.

        Julius Fedorovicius
        • Oct 30 2024
        • Reply

        Indeed it looks like that

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
  • What is Direct Traffic in Google Analytics 4 and How to Fix it
  • Google Tag Manager Preview Mode Not Working? 26 Ways To Fix It.
  • Google Analytics 4 Events Not Showing Up in Reports?
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings