• 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 7, 2022

How to Track Custom Events with Google Analytics 4

Updated: December 7th, 2022

I’ll be honest: Google Analytics 4 has a steep learning curve. It is very different from Universal Analytics (GA3), and event tracking is one of the reasons why.

In one of my previous blog posts, I explained how GA4 event tracking works in general. But if you understand the basics of Google Analytics 4 and are looking to dive deeper into custom event tracking, you’ve come to the right place.

In this blog post, I’ll explain how to track custom events with Google Analytics 4 and Google Tag Manager.

 

+ Show table of contents +

  • GA4 Event tracking in a nutshell
  • Example of a Custom Event in GA4: Menu Link Click
  • IMPORTANT: Register custom definitions
  • Test your custom events in Google Analytics 4
  • Where can I find custom events in Google Analytics 4 reports?
    • “Reports → Engagement → Events” report
    • Explore (a.k.a. Exploration reports)
  • Turning Google Analytics 4 Custom Events into Conversions
  • Want to learn more about event tracking in Google Analytics 4?
  • Tracking Custom events with Google Analytics 4: Final Words

 

GA4 Event tracking in a nutshell

If you want to understand the full scope of event tracking in Google Analytics 4, read this tutorial. It also includes a detailed video tutorial.

But here’s a quick 2-minute brief if time is of the essence. GA4’s event tracking does not require parameters like event category, action, or label to function correctly. Instead, you can use other recommended parameters or come up with your own.

There are 4 event types in Google Analytics 4:

  • Automatically collected events
  • Enhanced Measurement events
  • Recommended events
  • Custom events

Since the scope of this article is tracking custom events, we must ensure that the custom event names do not match those already defined by Google. To avoid this confusion, here’s a simple process that you can follow to structure your events (names and parameters) properly:

  • Check if the event that you want to track is among the automatically collected events
    If not, then check if your event name resembles any event among the Enhanced Measurement events (e.g., scroll or file_download)
  • If not, then check the recommended events and their naming convention
  • If none of the above categories apply to your events, you will need to create a custom event.

A process flow diagram on how to name your events for Google Analytics 4

Let’s now talk about the type of events in this article’s scope – custom events.

The configuration of Custom events is pretty much identical to recommended events. The only difference is that you will need to come up with event names on your own.

For example, if you want to track clicks on a particular image, you can use any of these as the event name:

  • image_click
  • click_image, etc.

When configuring custom events, there are a few things to remember. For example, your event name should not exceed 40 characters. So be sure to name your custom events seriously. You can check other limitations here.

Now, let’s look at the example where we want to measure clicks made to menu links on a website.

 

Example of a Custom Event in GA4: Menu Link Click

Note: menu link click tracking trigger conditions differ on most websites (because of different click classes, IDs, etc.). Try to do your best to apply this example.

I have several menu links on a demo website that I want to track.

Menu items on the AnalyticsMania demo website

First, you need to create a trigger that will indicate to Google Tag Manager when the menu link click event should fire. Enable Google Tag Manager’s Preview mode and try clicking on any of the menu links on a website. By doing this, you should see the Link Click event in the Preview mode’s left sidebar.

Link click event shown in Google Tag Manager's Preview & Debug Mode

If you don’t see it, you should:

  • have at least one Just Links GTM trigger activated on a page
  • or have “File download” or “Outbound links” tracking enabled in your Enhanced Measurement Settings

Let’s say that you don’t use Enhanced Measurement in GA4. Go to Google Tag Manager > Triggers > New > Just Links. Set the trigger to fire on All Link Clicks and save the changes.

Configuration of GTM trigger to fire on all link clicks

Creating this trigger will signal Google Tag Manager to activate its link-tracking functionality.

Then go to Variables > Configure (in the “Built-in Variables” section) and enable all Click-related variables.

Enabling all built-in click variables

Refresh the preview mode (by clicking the Preview button once again).

Preview button of Google Tag Manager's Debug mode

Now, head to your website and click any of the menu links (at least two of them).

Return to the preview mode, and you should start seeing Link Click events in the preview mode. Then, click the first Link Click event, and go to the Variables tab of the preview mode.

Click variables capturing information from page

Then click on the second Link Click event. I am currently looking for a variable that I could use to distinguish a menu link click from other link clicks. This variable will help me fire the Google Analytics 4 event tag at the correct action.

On closer inspection, both links contain the same Click Classes value, site-nav__link site-nav__link–main. By the way, nav means navigation. I will use this in my Just Links trigger.

 

Selecting the Click Classes variable as the condition

Go back to the list of triggers in your GTM container and click the previously created trigger for All Link Clicks. We’ll edit it and add a condition: Click Classes contains site-nav__link–main

Creating a custom trigger for the menu link click

Go ahead and save the trigger. Now, it’s time to create a Google Analytics 4 event tag.

Go to Tags > New > Google Analytics: GA4 Event. Select your existing GA4 Configuration tag and then enter the event name. Its value is up to you. Any of the following options are perfectly fine:

  • menu_link_click
  • menu
  • menu_item_click
  • menu click

These are just some examples and are not limited to these. Just keep in mind to follow the limitations of name length.

In my case, I used menu_link_click as the event name. But this time, sending just the event name is not very useful. You’d probably want to know which exact menu items get the most clicks. How about the menu item’s name and URL?

We could do that by sending additional event parameters. Even though you could use parameters already mentioned in the documentation of the Enhanced Measurement Events (like link_url and link_text), let’s create two custom parameters (because I just want to show you how to configure them).

I am going to pass two parameters, menu_item_url, and menu_item_name. I made these parameter names up, and you can do it too.

To send custom parameters, you must expand the Event Parameters section in the Google Analytics 4 event tag and click Add Row.

Configuring the GA4 event tag for menu link clicks

Enter the name of the first parameter. In my case, that is menu_item_url. Then, I will insert a variable that returns the clicked URL in the Value field. Luckily, GTM already offers such a variable called Click URL. Then, click the Insert Variable button and select the {{Click URL}} variable.

Let’s add the second parameter, menu_item_name. For that purpose, Google Tag Manager has {{Click Text}}, another built-in variable. Let the custom parameter return this value.

Since visitors to your website can translate your page, {{Click Text}} value will also change. Hence you will see a more diverse list of collected values in your GA4 reports.

Adding custom parameters to be captured by the GA4 event tag

If you want to send more parameters, you are free to include up to 25 custom parameters with a single event.

Assign the previously created Just Links trigger to this tag and save it.

Refresh the GTM Preview mode and click a couple of your menu items. Go back to the Preview mode and click those Link Click events. Check if the GA4 event tags for Menu Link Clicks have fired.

Menu Link Click event fired successfully in Google Tag Manager

Head to Google Analytics 4’s DebugView to ensure the event has registered.

IMPORTANT: even though you will see your custom parameters in Real-time reports and DebugView in GA4, you will not be able to see them in other GA4 reports. Unless you register those parameters as custom dimensions in Google Analytics. Read the next chapter of this blog post.

 

 

IMPORTANT: Register custom definitions

All custom parameters must be added as custom definitions in Google Analytics 4 if you want to see/use them in places like Funnel reports, Exploration, see their reporting cards in standard reports, etc.,

In Google Analytics 4, go to Admin > Custom Definitions. Since we sent 2 custom parameters with the menu link click, we must register them here.

Click the Create Custom Dimensions button and then enter:

  • The name of the parameter. You can enter whatever you want. Accordingly, GA4 will display the dimension in your reports. For example, you can name it “menu_item_url”, “Menu item URL”, or anything else.
  • Scope. Since we want to apply this parameter only to one event (and not to all events of the same user), we need to select Event.
  • Event parameter. Here, you must enter the name precisely as you entered it in the GTM tag. For example, if your parameter name is menu_item_url, you must enter it here like that. Don’t worry if the autocomplete feature of that field does not show your parameter yet. Instead, just enter it and save the dimension.

Details to fill when registering custom definitions

Then register a second parameter (in my case, menu_item_name) and save it. By the way, I sometimes use the words “custom parameter” and “custom dimension” interchangeably. In general, custom metrics and custom dimensions are both grouped as custom parameters.

And now we wait. Within the next 24 hours, the custom parameters will start appearing in your Google Analytics 4 reports.

 

Test your custom events in Google Analytics 4

Once you configure your custom events, it’s time to test them. The primary feature built for debugging GA4 data is the DebugView section. You can find it by going to Admin > DebugView.

That’s the place where your debugging should take place. Do not mix this with Google Tag Manager’s Preview and Debug mode. These are two different beasts.

To enable the debug mode in GA4, you have several options (any of them will work):

  • Enable the GA debugger Chrome extension
  • Send a debug_mode parameter together with an event
  • Have enabled Google Tag Manager’s Preview mode on a page that you’re debugging

In the case of the first option, install the extension here, and then click its icon (so you can see the ON ribbon). From this moment, you will start seeing your events in the DebugView tab.

The other option is to send a debug_mode parameter with every event you wish to see in the DebugView. In Google Tag Manager, you can do that by opening the GA4 Configuration tag and adding the following parameter:

Adding the debug_mode parameter in the GA4 Event Tag

If the debug_mode parameter contains any value, the event will appear in DebugView. If you are using a hardcoded gtag.js, here are the instructions for including the debug_mode parameter.

But since we are working with Google Tag Manager, having the GTM Preview mode enabled automatically sets the debug_mode to true. Thus the data will start appearing in the GA4 DebugView.

When you start seeing data in the DebugView screen, you can click on every individual event, and the appropriate list of parameters for each event will populate.

Click on that parameter to see the value that GA4 received. Now that is some granular debugging!

Confirming values received in DebugView screen

However, I have noticed some delays between the event happening on a website and then appearing in DebugView.
Sometimes, I have to wait several minutes until the events come in. That’s a bit unfortunate, and hopefully, the team behind Google Analytics 4 will improve this in the future.

Also, ensure you have selected the correct Debug device in the top left corner.

Checking the correct device from which information is being collected

If multiple visitors have enabled the debug view (e.g., they all have enabled the Chrome extension), you will see multiple devices there, which might require some time to find yourself. I’ve seen this apply especially to my blog. Many of my readers enable the GA Debugger Chrome Extension. So it becomes my task to find my device among the rest.

Anyway, once you start seeing data in DebugView, things will look like this.

Tracking conversion and events in GA4 DebugView screen

Blue icons highlight events and green icons represent conversions. Please ignore the fact that I treat menu_click events as conversions. It is just for demonstration purposes.

You will see the parameters sent together with an event when you navigate to the event. Click on the parameter to see its value.

Parameters recorded by the DebugView screen

Once you have made sure that the data is coming in and displayed correctly, you should submit your GA4 changes in the GTM container and publish it.

You can do that by clicking the SUBMIT button in the top right corner and completing all the steps the user interface asks you to do.

After validation, submit the changes

After that, you should soon start seeing the new data in your real-time reports.

On the left sidebar of the Google Analytics 4 interface, go to Realtime. Here, you will see the data coming into your reports. Unlike in the previous version (Universal Analytics), the new report allows you to see the data on a much more granular level.

First, you will see a map and a bunch of cards with traffic sources, the most popular events, and the number of users in the last 30 minutes (by the way, Universal Analytics’ real-time report shows the number of users in the last 5 minutes).

You can also take a look at the snapshot of an individual user. For example, you can do that by clicking the View user snapshot button in the top right corner.

The View User Snapshot option in GA4

Then, you will see a stream of all events of that particular user. You can click on them (just like in the DebugView) to see things on a more granular level. If you wish to look at another user/visitor, you can click the button here:

Change the visitor using the option in the picture

Press the Exit snapshot button in the top right corner to complete examining the snapshot.

Where can I find custom events in Google Analytics 4 reports?

This blog post focuses mainly on tracking custom events with Google Analytics 4. I will not dive deep into how to find insights, raise questions, answer questions, etc.

However, I can show you several places where you can find the event data you just sent to Google Analytics 4.

Keep in mind that Google is constantly updating Google Analytics 4. So if something looks different from what this blog depicts, don’t worry. Keep browsing the interface, and you’ll eventually find what you need.

So let’s take a look at what we have now. Here are some of the reports:

  • Admin > Events (this will show just the list of events with counts. Nothing fancy.
  • Reports > Engagement > Events
  • Explore (a.k.a. Exploration reports)

But that is not all. Since GA4 is an event-based analytics platform, every report is affected by events you send (in one way or another). The reports mentioned above are just the most notable examples.

 

“Reports → Engagement → Events” report

The Events Report gives you an overview of all events sent to your property + a couple of charts. Below them, you will see a list of events; if you click on any of them, you can look at the various parameters captured during the event.

How to navigate to the Events Report

Explore (a.k.a. Exploration reports)

The Explore section is the place where you will be able to drill down into your data. In the Exploration, you can use reports such as Free Form, Funnel Exploration, Path Exploration, etc.

Here is an example of a Free Form report. Remember that you will need to wait up to 24 hours for the data to come into your reports. So if you don’t see the data now, be patient.

Let’s say I want to see how users with different device categories interact with my site’s menu bar. Remember, I set up the menu_click event?

So, let’s go to Explore and click on the Free Form block.

How to navigate to Free Form Reports

Then in the Variables column, I need to include the menu_item_url custom dimension because I want to see how many clicks each menu URL got. Then, click the Plus icon and then find the menu_item_url dimension. Then, select it to be added to the list of possible dimensions in the report.

Adding custom dimensions to your Free Form report

If you CANNOT see the menu_item_url (or whatever custom parameter you are looking for), you must register that custom parameter in All Events > Manage Custom Definitions. And then wait for 24 hours until the data appears in the reports. If the reports don’t work correctly, wait longer.

Then let’s edit the Tab settings. Remove the existing dimensions in the ROWS and include the custom definition you want. In my case, that’s menu_item_url.

In the COLUMNS section, I used the Device category dimension. In the VALUES section, select the metric you want to see. I used the Event Count.

Then you will need to filter only those events that contain the menu_item_url dimension. In my case, that is just a menu_link_click event.

That’s why you should enter a filter at the bottom of the Tab Settings section: “Event name exactly matches menu_link_click.”

That’s it. Your report will now display how different device categories are clicking menu items, which ones are the most popular, and how many clicks they got.

 

Also, don’t forget to change the date range if you need it. You can do this in the top-left corner of the Exploration interface.

You can also use event data in things like funnel reports, but let’s keep it for another tutorial (hopefully) in the future.

 

Turning Google Analytics 4 Custom Events into Conversions

Some events are more important than others; for example, the most important interactions were termed goals in the previous GA version, now called conversions.

If you want to learn how to configure conversions in Google Analytics 4, watch the video tutorial below or read this in-depth blog post:

 

Want to learn more about event tracking in Google Analytics 4?

Honestly, in this video, I was just scratching the surface of what you should know about event tracking. If you want to learn more, head over to this blog post. In it, you will find topics like:

  • How to plan your event structure
  • Automatic event tracking
  • Recommended events in Google Analytics 4
  • How to create custom events directly in Google Analytics 4 interface
  • How to modify events directly in Google Analytics 4 interface
  • and more!

 

Tracking Custom events with Google Analytics 4: Final Words

This article was longer than expected because there’s so much to cover. But if this process of tracking custom events with Google Analytics 4 adds value to your work, it is worth it. If you want to learn more about tracking events, you can learn more about it here):

  • Check the automatically tracked events and what Enhanced Measurement has to offer.
  • If an event (that you wish to track) is not listed, check the recommended events and try to use their naming convention and parameters.
  • If none of the recommended events match your need, create a custom event in Google Analytics 4 (the entire blog post was just about this part).

Here are some key takeaways:

  • GA4 rids you of the need to define parameters like Event Category, Event Action, and Event Label fields. You can create them manually as custom parameters, but doing so won’t make sense.
  • You can send custom parameters (dimensions and metrics) with events (both recommended and custom).
  • You can send up to 25 parameters with a single event.
  • If you want to see a parameter in the GA4 report, you must register it as a custom definition. There is a limit of 50 registered custom dimensions and 50 registered custom metrics per property.
  • Use Google Analytics 4 DebugView to test the incoming events on a granular level.

Got more questions about tracking custom events with Google Analytics 4? The comments section is at your service.

 

Julius Fedorovicius
In Google Analytics Tips
26 COMMENTS
Raimundas
  • Nov 29 2020
  • Reply

Hello Julius,

I tried to set up meniu link click tracking, but in the preview mode "Click Classes" value equal - ". As you mentioned in the article it should have some differentiator like in your example - "site-nav__link site-nav__link–main". But in my case, the value is - ". So how should I get that differentiator? Should web developer to set up it?

    Julius
    • Nov 29 2020
    • Reply

    Ask a developer. Or learn CSS selectors

      Raimundas
      • Nov 29 2020
      • Reply

      Thanks!

      Bernie
      • Mar 16 2022
      • Reply

      Thank you SO much! This was extremely helpful.

Deepak Kumar
  • Nov 30 2020
  • Reply

Hi Julius, thank you for this walk through. I was able to replicate it for my client and event tracking is working perfectly fine.

Di Prima
  • Dec 7 2020
  • Reply

Hi Julius,

Thx for your explanations. It's very useful ! Keep going.

I have a request for you. I try to find a way to combine click event & element visibility event.

I track clickable slides in a hp slider. I track clicks by slide with a custom events that contains the name of the slide, the position... The reports works well in GA4. But i would like to go further and add true view parameters to have the number of views by slide in addition in my analytics report (to calculate the CTR).

I've tested the element visibilty on another element and i get the number of time this element is visible on the page. So i would like to have that data for my slide.

Do you know if it's possible to combine events for the same element in tag manager and ga ?

Here is my slide code :

Tag Manager test

Thx in advance.

Amelia Jacob
  • Dec 8 2020
  • Reply

Hey Julius,

Great blog! You explained it very well. It really helped me in my project.

Thank you.

Pete
  • Dec 14 2020
  • Reply

Hey Julius,

just wanted to thank you for such a clear and concise blog. I'm a complete novice as web dev and associated analytics, but thanks to your various blogs I've been able to bumble my way through to having some insight on what is happening on my site.

explaining complex things to a novice so they can understand them is a sign of a true master.

thank you

Jet
  • Dec 23 2020
  • Reply

Hi Julius,

Thank you for your amazing guide.

I'm wondering if I can still see the old data if I register the custom parameter after a while the associated events have been recording.
E.g. I started recording events and the corresponding parameters in Oct, but I only enable the custom parameters on GA4 UI in Dec. Can I still see the custom parameter data of Oct and Nov on the report?

Thanks a lot.

    Julius Fedorovicius
    • Dec 23 2020
    • Reply

    Hi, you won't be able to see the parameter in GA4 reports before it was registered

      Jet
      • Dec 23 2020
      • Reply

      Hi Julius, thank you for your prompt reply. And the old data won't be backfilled even the events and associated parameters have been recording before the registration on GA4 UI, right?

      Thanks a lot.

Jet
  • Dec 23 2020
  • Reply

Hi Julius, thank you for your prompt reply. And the old data won't be backfilled even the events and associated parameters have been recording before the registration on GA4 UI, right?

Thanks a lot.

Ashish
  • Jan 21 2021
  • Reply

Hi Julius,

I am trying to track phone number click for my client in GA4 by using google tag manager but the event parameter which I set is not working correctly while tag configuration. Please suggest the event parameter to track phone number link click.

Thanks in advance.

Manjunath S A
  • Dec 28 2021
  • Reply

Hello Julius,

Thank you for your wonderful guide.
I had created custom events in GTM, I am able to track them in configure section of Google analytics platform after submitting the GTM container, but these events are not visible in Engagement section of GA4 even though the time constraint has passed 24 hours+, please help me with this issue?

Sagarbhatt
  • Feb 9 2022
  • Reply

Sir thank you very much for all your content it is helping me a lot. I am a big fan of your content. I kindly request you to please share a blog or your views on how to do social tracking using google analytics 4. As researched a lot about this topic but I am unable to find any relevant content regarding the same. It will be a great help thank you very much.

Patrick Wolf
  • Mar 5 2022
  • Reply

Hi, thank you for the very interesting post. We use GTM and both a normal GA property and now a GA4 property.The GA4 property is linked to the GA property (as far as I can see). I then setup GTM with the GA4 event tag and in GA4 I can see in the DebugView that data for an event has been transmitted. However, when I switch to "Configure" and click on "Events" none of my custom events is shown in the "Existing events" table. By contrast, the message "Integrate the SDK or set up tagging to start getting event data. You'll see your first event reports here within 24 hours." is displayed here. When I click on "Modify event" I can see my two configured custom events, but they are not listed in the overview table as mentioned before.

Do you know why this message appears? The GA property stream is configured as Webstream.

    Julius Fedorovicius
    • Mar 5 2022
    • Reply

    Hi, your question contains the answer. 24 hours.

akmal sulton
  • Apr 26 2022
  • Reply

something is wrong here, it is not possible to track clicks on the banner

rob
  • May 5 2022
  • Reply

what if you have been tracking event through code and not GTM, does the code change at all? would it still be going to GA4? Thanks!

Ryan
  • May 13 2022
  • Reply

Hi Julius,

I'd love to see an updated version of this.
The report section seems to have changed a lot since 2020.
Filters don't seem to be present in the tab settings of free form reports.

Thanks for your work.

Alex Homsi
  • May 20 2022
  • Reply

I am trying to modify outbound clicks that have link domain for social media.

I have it as the following

Modification name
instagram_social_click_type

Matching conditions
Modify events that match ALL of the following conditions

matching condition

Parameter Operator Value
event_name equals click

Parameter Operator Value
link_domain contains (ignore case) instagram.com

Parameter New value
click_type social

It used to work but now it seems like it is not working any ideas?

Tomasz
  • Jun 2 2022
  • Reply

Hello, Im struggled with configuration of transaction value at GA4. I've already done with Event configuration "Purchase" but I can not set a transaction value for it to measure e-commerce.
Can You help me?

Tatiana
  • Nov 29 2022
  • Reply

Hi,
Can you recommend any resources how to achieve the same when GA4 is tracked via gtag.js?

Thank you very much for your content.

Iulia
  • Jan 9 2023
  • Reply

Hello, I have created several custom events using the GA4 interface and based on page view existing events. They show up in debug view as well as in Realtime Report, but, although more than 48 hours have elapsed since their creation, they do not show up in Events report. I also marked them as conversions using New Conversion Event in Conversions Tab but they do not show up in Conversions Report either. I have read on this page https://support.google.com/analytics/thread/184895880/google-tag-manager-events-not-showing-in-ga4?hl=en that other people are facing the same issue and that it could be due to thresholding applied by GA4. Do you have any idea about what can be done in order to see these events in the reports? I have also tried free form explorations, but thresholding applies there too. Thanks a lot!

John
  • Feb 1 2023
  • Reply

This is great, I am wondering what other important events we should track other than recommeded ecommerce and non-ecommerce events?

Here I got few events idea and listed below which we can track,

Menu link clicks
Button/link clicks
Image clicks

Please share if you have any idea or list.

John
  • Feb 1 2023
  • Reply

This is great, I am wondering what other important events we should track other than recommended ecommerce and non-ecommerce events?

Here I got a few non ecommerce event ideas, please share if you have any other ideas or lists.

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