February 14, 2024
How to Track Events with Google Analytics 4 and Google Tag Manager
Updated: February 14th, 2024
When Google Analytics 4 was introduced, it was announced as the event-based analytics tool where everything is an event (from pageview to purchase).
There are so many things to know about all of this that eventually, everything materialized into a blog post and a video tutorial.
Today, I will show how to track events with Google Analytics 4 and Tag Manager.
Sure, I could write a couple more paragraphs in this introduction to hook you up and intrigue you, but I will be honest: this article is already a behemoth. It is almost 7000 words long and includes many valuable things and tips. And every artificially inserted paragraph would simply be disrespectful.
Also, keep in mind that this guide focuses mainly on the setup. I will include a chapter with a quick overview of reports where you will see the event data (including custom events), but that’s about it.
Table of Contents
-Here’s what you will learn in this article –
- 4 categories of events in Google Analytics 4
- Create new events (in the GA4 interface)
- Modify Events (in the GA4 interface)
- Test your events in real-time reports and DebugView in Google Analytics 4
- Where can I find the events data in Google Analytics 4 reports?
- How to plan your event naming convention and structure
- Event limits
- Useful resources about event tracking in Google Analytics 4
- Final Words
Video tutorial
If you prefer video content, here’s a tutorial on my YouTube channel (*cough* consider subscribing *cough*). However, the blog post is more in-depth. Consuming both formats of content would help you understand this topic better.
4 categories of events in Google Analytics 4
In GA4, events fall into 4 categories:
- Automatically collected events
- Enhanced Measurement events
- Recommended events
- Custom events
The process of how you should plan the structure of your events (names and parameters) is by doing the following:
- Check if the event that you want to track is among the automatically collected events
- If not, then check if your event is mentioned 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, create a custom event with an event that you want
As you read through, you will learn to determine which of these categories your event belongs to. And once you get more familiar with GA4 events (and how to configure them), I will share some tips (and a sample spreadsheet) that can help you think about the structure of your events and a naming convention.
#1. Automatically captured events
Since my blog focuses on web tracking, this guide will take the same route.
GA4, by default, automatically tracks certain events. You can find a complete list here (it contains both app and web events). For now, let’s ignore Enhanced Measurement events and focus only on automatically captured events. The list of website events goes like this:
- first_visit. This is the first time a user visits a website or launches an app.
- session_start. When a user engages the app or website and starts a new session
- user_engagement. This event is fired 10 seconds after the visitor has stayed on a page. But it also might periodically fire while the app is in the foreground. You can learn more here.
I didn’t mention the page_view here because I added it to the Enhanced Measurement section. And once again, if you want to see the app events, you can check them here.
#2. Events tracked via Enhanced Measurement
When you configure a web data stream in Google Analytics 4, you have an option to enable Enhanced Measurement. Enhanced Measurement Events help marketers get as many events in the reports as possible without the need to cooperate with developers or configure in Google Tag Manager.
If you go to Admin > Data Streams > Select the web data stream, the following window will open where you will see a section called Enhanced Measurement.
By default, this feature is enabled and will automatically track the following events:
- Page view (event name: page_view)
- Scroll (event name: scroll)
- Outbound link click (event name: click with the parameter outbound: true)
- Site search (event name: view_search_results)
- Video Engagement (events: video_start, video_progress, video_complete)
- File Download (event name: file_download)
- Form Tracking (events: form_start, form_submit)
If you want, you can disable/enable GA4 events individually, and you can do that by clicking the gear icon in the Enhanced Measurement section and then clicking the toggle buttons.
In addition to this, you can customize some of the events. Let’s take a quick look at each event and their respective settings.
page_view. This event is sent to GA4 when a new page loads or the URL of the page changes without reloading the page (a.k.a. history change events)
scroll. This event is sent to GA4 once per page when a visitor scrolls below the 90% threshold of the page height.
click. This event registers in GA4 for the outbound link click. (when a clicked link redirects a visitor to another domain. An additional parameter outbound with the value “true” is also passed to GA4) Other parameters like link_classes, link_domain, link_id, link_url, are also sent along with this event.
If your business operates on several domains, the outbound click event will fire regardless. You would need to go to Tagging Settings (of that very same event stream) > Configure your domains and then enter the domains of your business. All the domains that are listed there will not trigger the outbound link click event.
view_search_results. This event is triggered when the page loads and its URL contains a query parameter, such as q, s, search, query, keyword. You can include up to 10 query parameters to be passed back to Google Analytics 4.
If the URL of the search results page is https://www.yourwebsite.com/search?key=my+search+term, then you should enter the word “key” (without quotation marks in the settings of the search event). Keep in mind that you can pass only 10 parameters from the search URL back to GA4.
For example, if the URL of your search results looks like this: https://www.yourwebsite.com/search?key=search+term&results=50,you could include the “results” (without quotation marks) in the 2nd field of the configuration. Then this parameter will be automatically tracked by GA4.
video_start, video_progress, video_complete. Enhanced Measurement can track interactions of the embedded Youtube video on your website and then sends “video_…” events to GA4. But those embedded Youtube video players must contain the ?enablejsapi=1 parameter in their URL. And that is not always available on websites. Also, here’s a list of reasons why Youtube video tracking might not work out of the box, hence you will definitely need some tweaks.
Because of those nuances, I’d say that this automatic video tracking will not work in as many cases as you might think, hence I’d personally vouch for doing that with GTM.
file_download. This event is sent to GA4 when a link is clicked and that link contains one of the following file extensions: .pdf, .xls, .xlsx, .doc, .docx, .txt, .rtf, .csv, .exe, .key, .pps, .ppt, .pptx, .7z, .pkg, .rar, .gz, .zip, .avi, .mov, .mp4, .mpe, .mpeg, .wmv, .mid, .midi, .mp3, .wav, .wma. In other words, if the link opens/downloads a file. It is currently impossible to update the list with other extensions in the GA4 interface.
form_start, form_submit. These events are recorded when the website user interacts or successfully submits a lead form during their session. GA4 records parameters like form_id, form_name, form_destination, and form_submit_text when it is fired. Personally, I don’t recommend using them as they often fire when they shouldn’t.
Once you select which events you wish to track, hit Save in the top right corner and then make sure that Enhanced Measurement is enabled (the toggle is blue).
From that moment, your Google Analytics 4 will start automatically tracking the events. See this chapter to learn how to check if your data is coming in correctly.
#3. Recommended events
As I have previously mentioned in this blog post, when you try to pick the name (and the parameters) for your event, first take a look at automatically tracked events (maybe those events are already being tracked), then check the Enhanced Measurement events. If none of those GA4 events cover your case, look at the recommended events list. Google has published several pages for different vectors:
Even though Google Analytics 4 data model is very flexible (and you can use a different event name for login, for example, logged_in), Google recommends that you implement the recommended events when it makes sense to you.
Together with those events, you can use recommended parameters. For example, for the login event, there is a method parameter. It would be helpful to track if users can log in to your website via email, google login, facebook login, etc.
#3.1. Example of a Recommended Event: login tracking
Let’s continue with the login example mentioned above. Let’s say that I am working on a website where visitors can log in. I want to track the exact moment when users/visitors do so and which login method they use.
I have asked a developer to activate the following dataLayer.push() code when a user logs in to his/her account.
<script> window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event' : 'login', 'loginMethod' : 'email' // this should be replaced with an actual login method }); </script>
The user’s login method should replace the loginMethod parameter’s value. That is the developer’s job to write custom code that replaces it.
When a developer implements that code and I successfully log in to GTM’s preview mode, I should see the following Data Layer event (see the screenshot below).
Remember that this event is a GTM (or Data Layer) event. It is not sent to GA4 (or any other platform) yet. Right now, it is just a collection of data points that are at our disposal, meaning that we can send the data further to other tools like GA or FB pixel (or any other analytics/marketing platform that we use).
Now, let’s create a Data Layer Variable that will access the value of the loginMethod and also a Custom Event Trigger for the login event in the Data Layer.
In Google Tag Manager, go to Triggers > New > Custom Event, enter the following settings and press Save.
Then go to Variables > User-defined variables > New > Data Layer Variable and enter the following settings:
I entered the loginMethod because that is what a developer pushed to the Data Layer. If your parameter’s name is different, then enter that name. Important: variable names are case-sensitive.
After you create a variable and a trigger, it’s time to make a Google Analytics 4 event tag. With it, we can send the event data to GA4.
But first, let’s create a Constant variable in Google Tag Manager (it will make your tag management more convenient). Go to Variables > Variable Configuration > Constant and paste your GA4 Measurement ID.
Now, the time has come to create the Event Tag.
Before you do this, I expect you are already tracking pageviews and have a Google Tag. If you don’t know what it is, it probably means you haven’t installed Google Analytics 4 with Google Tag Manager. In that case, read this guide first.
After you have the Google Tag in Google Tag Manager, go to Tags > New > Google Analytics > Google Analytics: GA4 Event. Inside that tag, we are going to use the Google Tag too.
In a nutshell, Google Tag is a tag that contains your GA4 tracking configuration (Measurement ID, cookie settings, etc.), and then event tags can be configured to reuse those settings. That’s exactly what we are going to do.
Let’s go back to the GA4 event tag that we want to create.
To avoid manual work and setting up all the fields/customizations in every event tag, you should enter the Measurement ID that you also used in the Google Tag.
The green checkmark on the right will show that Google Tag Manager has found an existing Google Tag using the same Measurement ID (which is good). If you don’t see the checkmark, cut and paste the variable name again and this should trigger the variable validation.
But at the same time, you can still configure additional settings in your event tag. If a particular parameter/field is configured in both the event tag and in the configuration tag, the event tag’s field gets a higher priority.
Now, let’s continue the configuration of an event. Enter the event name. Since we are tracking the login event and the name “login” is recommended by Google, this is exactly what we are going to enter.
And then, let’s enter an additional parameter, the login method. To do that, expand the Event Parameters section, click Add Parameter, and then enter method in the Event parameter field and insert the previously created Data Layer Variable in the Value field. You can insert the variable by clicking the button next to that field.
Why did I enter the method in the Parameter Name field? Because I saw that in the list of Recommended Events.
What about custom parameters? What if you also want to pass the user’s pricing plan or something else?
Sure, you can do that. But I will explain custom parameters/dimensions in the next chapter. All you need to know right now is that it’s completely possible to send custom parameters with recommended events.
Now, it’s time to test. Enable the Preview mode in Google Tag Manager, log in to your website, and check if your GA4 Event Tag fired on that event. To do that, you must click on the login event in the Preview mode’s left side and check if the tag fired.
If you indeed see that the tag has fired, that’s a good start. Now, you will need to go to Google Analytics 4 and check DebugView. You will learn more about that in this chapter of the blog post.
By the way, if you want to implement sales (a.k.a. Ecommerce tracking), you must also use recommended events and follow Google’s strict requirements. Learn more here.
#4. Custom events
You can create custom events if you want to send an event that is not mentioned among the automatically tracked events, Enhanced Measurement, or Recommended 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 your own names.
For example, if you want to track clicks on a call-to-action button, the name of the event can be any of these:
- call_to_action
- cta_click
- cta, etc.
Or anything else.
Speaking of custom event tracking, let’s look at the example where we want to measure clicks on menu links on a website.
#4.1. 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.
The first step is to create a trigger with the right conditions that distinguish any click from a menu link click.
Enable Google Tag Manager’s Preview mode and try clicking any of the menu links on a website. Once you do the first link click, you should see the Link Click event in the Preview mode’s left sidebar when you click on any of the links.
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 “All link clicks” and save the trigger.
Creating this trigger will enable the link-tracking functionality in Google Tag Manager.
Then go to Variables > Configure (in the “Built-in Variables” section) and enable all Click-related variables.
Refresh the preview mode (by clicking the Preview button once again).
Then go to your website and click any of the menu links. Actually, click at least two of them. Return to the preview mode, and you should start seeing Link Click events in the preview mode.
Click the first Link Click event and go to the Variables tab of the preview mode.
Then click on the second Link Click event. I am currently looking for some variable to help identify a menu link click. I don’t want to fire my GA4 event tag on any link click. Instead, I want to fire it precisely on a menu link click.
After taking a closer look, I see that both links contain the same Click Classes value, site-nav__link site-nav__link–main. By the way, nav means “navigation” in this context.
Great! Now I’ll use this in my Just Links trigger.
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
Save the trigger.
Go to Tags > New > Google Analytics > Google Analytics: GA4 Event.
Insert the constant variable that contains your GA4 measurement ID (you created it previously in this blog post), and you should see a green checkmark. If you don’t see it, then cut and paste the constant variable name in that field (to trigger the validation).
Then enter the event name. Its value is up to you. Any of the following options are perfectly fine:
- menu_click
- menu
- menu_item_click
- menu click
- etc.
These are just some examples. Since we are working with a custom event, we can name it whatever we want (as long as we follow the limitations of name length, for example).
In my case, I used the menu_link_click event name. But this time, sending just the event name is not very useful. You’d probably want to know which exact menu items are clicked more often. How about we also send the name of the menu item and the URL?
We could do that by sending additional event parameters. Even though you could use parameters that are already mentioned in the documentation of the Enhanced Measurement (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. That’s what the flexibility of the data model offers.
To send custom parameters, you must expand the Event Parameters section in the Google Analytics 4 event tag and then click Add Row.
Enter the name of the first parameter. In my case, that is menu_item_url. In the Value field, I will insert a variable that returns a clicked URL. Luckily, GTM already offers such a variable. It’s called Click URL. Click the Insert Variable button and then select the {{Click URL}} variable.
Let’s add another parameter, menu_item_name. For that purpose, GTM offers another built-in variable, {{Click Text}}. Insert it as well. Since visitors of 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.
If you want to send more parameters, Google allows you to send 25 parameters with a single event.
Assign the previously created Just Links trigger to this tag. Save the tag. 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.
Head over to Google Analytics 4 to Google Analytics 4 and check the DebugView. You will learn more about that in this chapter of the blog post. After you test everything, hit PUBLISH in the top right corner of the GTM interface.
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.
#4.2. IMPORTANT: Register custom definitions
If you are sending custom parameters to GA4 and you plan to use them in places like the Google Analytics 4 interface or Google Data Studio, you have to register them as custom definitions.
Here’s an exhaustive article on how to set this up. If you want to learn all the details, read it.
But if you are in a rush, here’s a quick summary. 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. It can be whatever you want; your reports will display the dimension. 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. This is where you have to enter its name precisely as you entered it in the GTM tag. If your parameter name is menu_item_url, you must enter it here precisely like that. Don’t worry if the autocomplete feature of that field does not show your parameter yet. Just enter it and save the dimension.
Then register a second parameter (in my case, that was 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.
======
Sometimes, you might want/need to create/edit events directly from the Google Analytics 4 interface. Well, now you can. Read the following two chapters to learn more about these features.
Create new events (in the GA4 interface)
Creating conversions in GA4 is pretty straightforward. It’s enough to click a toggle next to an event in the Admin > Events list.
But there is one problem. If you toggle the event and mark it as a conversion, ALL of those events will be treated as conversions (from this point moving forward). But what if you want to have only certain events marked as conversions?
Example: you have a “Thank you” page to which users are redirected when they subscribe to a newsletter. Let’s say that the URL is https://www.mywebsite.com/thank-you/. If I mark the page_view event as a conversion, ANY pageview will become a conversion. How can I separate only those pageviews that happened on the /thank-you/ page?
One way to do this is to send a dedicated event (with a different name) from Google Tag Manager/Gtag.js. Another option would be to use the Create Event feature in the GA4 interface.
This feature allows you to create a new event based on other incoming events. Go to Admin > Events page, click Create Event and then click Create.
Enter the name of the custom event. You can name it whatever you want. Make sure the name is clear to understand. thankyou_page_visit might be a good option.
Then let’s move on to the Matching Conditions section. Here we must tell GA4 what kind of event we are looking for. Then, when that particular event is spotted, our thankyou_page_visit should also be created.
In my case, I need to enter the following conditions:
- event_name equals page_view
- page_location contains /thank-you/
If you want to copy all the parameters from the page_view event to the new event, keep the checkbox Copy parameters from the source event enabled.
If some of the parameter’s name is incorrect and needs fixing, you can Add Modification in the Parameter Configuration section. For example, if an event contains the parameter pricingPlan, but you want it to be pricing_plan, you can introduce a new field (and reuse its value) while removing the incorrect parameter (by leaving the New Value empty).
Look at [[pricingPlan]] in the screenshot above. Double square brackets mean that GA4 will reuse the value of the parameter pricingPlan in that event.
Once you save the changes, you can view them in the Real-time reports and the DebugView of GA4. You will learn more about that in this chapter of the blog post.
Also, when you create that new event in GA4 (and you want that to become a conversion), don’t forget to mark that event as a conversion on the Configure > Events page.
If you don’t like to wait for up to 24 hours (because that thankyou_page_visit will not appear in the list of all your events immediately), you can create a new conversion immediately.
Click the Admin section on the left sidebar of your GA4 interface. Then go to Conversions.
Then click New conversion event.
Then enter the name of the event that you have just created. Click Save.
That way, you will mark the newly created thankyou_page_visit event as a conversion (without the need to wait for 24 hours until it appears on the Admin > Events page.
Personally (since I am a Google Tag Manager fan), I always prefer managing all of my events tracking there. Because if you have some events in GTM and others in the GA4 admin panel, this might cause confusion in the future (e.g., if a new colleague takes over your analytics setup).
Modify Events (in the GA4 interface)
If you don’t want to create new events (like in the previous chapter) but instead, just want to fix a typo in the existing events, you can use the Modify Events feature in the Google Analytics 4 interface.
If you want a quick rundown on how to get this done, here’s a video tutorial that should help you.
In my Admin > Events report, I see two page_view events.
- page_view
- page_view?undefined
I have no idea where that page_view?undefined came from but I don’t want to see it in my reports. How do I fix it?
I can do that by going to the Admin > Events report and clicking Modify Event.
Then click Create.
- Enter the name for the fix (this is for internal use)
- Then enter the matching condition (in my case, that’s event name equals page_view?undefined
- And then enter the needed modifications (in my case, that’s event_name and page_view)
If GA4 spots an event with the name page_view?undefined, it will change its name to page_view.
As you can see, the interface and flow here are similar to the Create Event feature I described in the previous chapter.
Once you save the changes, you can view them in the Real-time reports and the DebugView of GA4. You will learn more about that in this chapter of the blog post.
Remember that you can create up to 50 modifications per property and that this feature does not apply to historical data, only to the new incoming events.
Test your events in Google Analytics 4
Once you configure your GA4 events, it’s time to test them. The primary feature built for debugging GA4 data is the DebugView section.
Head over to your Google Analytics 4 account > Admin > Debugview.
That’s the place where your debugging should take place. Do not mix this with the GTM Preview and Debug mode. They 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 that you can see the ON ribbon). From this moment, you will start seeing your events coming into DebugView.
The other option is to send a debug_mode parameter with every event that you wish to see in the DebugView.
In Google Tag Manager, you can do that by opening the Google tag and adding the following parameter:
If the debug_mode parameter contains any value, the event will show up 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, you can click on every individual event to list out the parameters it passes along.
Click on that parameter to see the value that GA4 received. Now that is some granular debugging!
However, I have noticed some delays between the event actually happening on a website and then appearing in DebugView. Sometimes, I have to wait for 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 that you have selected the correct Debug device in the top left corner.
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 more time to find yourself.
I’ve seen this happen to my blog so many times. Many of my readers enable the GA Debugger Extension, leaving me to guess which device (out of the other 15) is mine.
Anyway, once you start seeing data in DebugView, things will look like this.
Events are marked with blue icons, and conversions with green. Please ignore the fact that I treat menu_click events as conversions. This is just for demonstration purposes 🙂
You will see the parameters sent along with an event if you click it. Click on the parameter to see its value.
Once you 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 that, you should soon start seeing the new data coming in your real-time reports as well.
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 lets you know the data on a much more granular level.
First, you will see a map and many cards with traffic sources, the most popular events, and the number of users in the last 30 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.
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:
To exit the snapshot, press the Exit Snapshot button in the top right corner.
Where can I find the event data in Google Analytics 4 reports?
This blog post focuses mainly on the setup of event tracking in 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.
But if you also want to learn how to analyze the data and get insights out of your GA4, then take a look at my Google Analytics 4 course.
Anyway, let’s take a look at some reports. 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 above are just the most notable examples.
“Reports → Engagement → Events” report
This is an overview of all events that were sent to your property + a couple of charts. Below them, you will see a list of events and if you click on any of them, you will take a closer look at that event’s data.
Note: The GA4 sidebar is highly customizable. The location of the “Events” report in your property might differ, so keep looking.
Explore (a.k.a. Exploration reports)
The Explore section is where you will be able to drill down into your data. In the Explorations, 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 (sometimes even up to 48 hours). 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_link_click event? So, let’s go to Explore and click on the Free Form block.
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. So, I click the Plus icon and then find the menu_item_url dimension. It will then be included in the list of possible dimensions in the report.
If you CANNOT see the menu_item_url (or whatever custom parameter you are looking for), you must register that custom parameter in Configure > Events > Manage Custom Definitions. And then wait for 24 hours until the data appears in the reports. If the reports don’t work properly, wait for even longer.
Then let’s edit the Tab settings. Start by removing the existing dimensions in the ROWS and include the custom definition that you want to include. 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 that you would like 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_click event. (Previously in this blog post, I used menu_link_click, but I accidentally wrote this chapter and created screenshots with menu_click in mind. Sorry for this little confusion.)
You should create a filter at the bottom of the Tab Settings section. Set it as Event name exactly matches menu_click.
That’s it; your report will now display how users with different types of devices are clicking menu items, which ones are the most popular, and the number of clicks.
Also, don’t forget to change the date range if you need it. It is available 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.
How to plan your event naming convention and structure
Note: This chapter will just provide an overview of how you should do it. If you want to learn a lot more details, take a look at my Google Analytics 4 course. Speaking of actual planning, I would say that a spreadsheet is your best friend.
- Write down all the events that you want to track, and then:
- Check whether they fall under the categories: automatically collected, enhanced measurement, or recommended.
- If yes, check the naming convention of event names and parameters (dimensions). If not, then come up with your values. Just keep in mind that there are some limitations related to the length.
Here is an example of the spreadsheet with events that you could prepare and then try to pick the correct naming convention. You can use it as an example/inspiration to create your own spreadsheet. Let’s take a quick overview of the spreadsheet.
There are two sheets:
- The first one is for the list of events and what kind of parameters you want to track together with them
- The second one is a list of parameters with their explanations
The first sheet:
- In column A, you should enter the event name that you will use in Google Analytics 4. You should pick this name based on the previously described process: check the automatically tracked events, enhanced measurement, and recommended events. If none of the events match yours, then add a custom name. Using this principle to name the event, e.g., event_name (all lowercase and connected with an underscore), looks pretty clean. Event names like “Submitted the Form” will also work, but the all-lower-case-with-underscore looks cleaner (I believe the term snake-case applies here)
- In column B, you can just briefly describe an event in plain English
- Column C is for type (is it Automatically collected, Enhanced Measurement, Recommended, or Custom?).
- Column D is for parameters you want/plan to track with particular events. I did not include the default parameters automatically tracked with every event: language, page_location, page_referrer, page_title, screen_resolution.
If you are dealing with mobile apps as well, you could include an additional column, “Platform” where you could enter “web” or “Android / iOS”.
The second sheet:
- Column A is for the parameter name
- Column B is for a platform. If you are working just with the website, feel free to remove that column.
- Column C is the type (is it Built-in, Recommended, or Custom). Built-in means that it is used by automatically tracked events or Enhanced Measurement. Recommended parameters are for recommended events. Custom parameters are your own unique events.
- Column D is for description (in plain English).
IMPORTANT: This spreadsheet is just an example. You don’t have to follow it blindly. If you wish, you can take just some parts and adapt them to your needs.
Once you prepare the plan, you can track events with Google Analytics 4. Don’t rush too soon. Otherwise, you might face the consequences in the long run.
Event limits in Google Analytics 4
Keep in mind there are some limits to event creation. I would always recommend that I would always recommend for you to refer to this page when it comes to limits. Most likely, it will be more up-to-date in the future than my blog post.
Anyway, here are some of the things you should remember now:
- There is no limit for events in total (at least for now). But you never know what might happen in the future 🙂
- You can have up to 50 event-scoped custom dimensions and 50 custom metrics registered in a property. The keyword here is registered. This means that you have to go to Admin > Custom Definitions and have them configured there. You can send more custom parameters, provided they are not already registered.
- You can send up to 25 parameters with an event
- There are some length limits for event names and parameters as well. Both (the event name and the parameter name) must be up to 40-characters-long.
To learn more about the limits, as always, refer to this page.
Useful resources on how to track events with Google Analytics 4
Here are some good resources that you might find helpful:
- Automatically collected events (by Google)
- Enhanced measurement
- Recommended events
- Custom Dimensions
- Custom Metrics
- Collection and configuration limits (by Google)
- 5 best practices for creating your events and parameters in GA4 (by Ken Williams)
Track Events with Google Analytics 4 and Google Tag Manager: Final Words
Phew! That was a long guide! I expected it to be lengthy, but not THAT MUCH. However, event tracking in Google Analytics 4 is a very extensive topic; hence, the blog post’s length is just proof of that. And the almost 40-minute-long Youtube tutorial supports that statement.
To sum up, here’s is the recommended process of how you should track events with Google Analytics 4:
- Check the automatically tracked events and what Enhanced Measurement has to offer.
- If an event (that you wish to track) is not listed there, check the recommended events and try to use their names and parameters.
- If none of the recommended events match your needs, then create a custom event.
Here are some of the key takeaways from this blog post. However, if you just skimmed the article, please read it carefully (and if you have time, watch the video as well). There are many gotchas there.
- Everything is now an event in Google Analytics 4—even pageviews.
- No more Event Category, Event Action, or Event Label fields. If you want, you can create them manually as custom parameters, but that does not make sense.
- There is no limit for the total number of events in a Google Analytics 4 property (e.g., you can have 1 billion events sent to GA if you want). But the list of unique event names (for mobile apps) cannot exceed 500 (per visitor/user). This limit does not apply to websites.
- 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, register it as a custom definition. There is a limit of 50 registered event-scoped custom dimensions and 50 registered custom metrics per property.
- You can create new events in the GA4 interface based on incoming events.
- You can modify/fix incoming events in the GA4 interface (e.g. if there are some typos)
- There are some other limits as well (regarding the length of names/parameters, etc.)
- Use Google Analytics 4 DebugView to test the incoming GA4 events granularly.
84 COMMENTS
Thank you so much!
Quick question...where can i find the results/data from the google tags i have created in google analytics? For example, I have created a google tag to track a specific email sign up. Everything is firing properly using google tag extension, and everything looks good in debug viewer in ga and gtm. But where can I find my numbers in google analytics from the tags I created? Please advise.
There is a dedicated chapter in the blog post mentioning the reports. Please read that. Also, wait up to 24 hours after the event was sent.
I read the section you are referring. The info you have provided is really great. Very detailed and thorough. However, I still am not seeing where my customized google tags data is appearing in google analytics. Follow up Question...If debug view shows data in realtime, then why would I have to wait 24 hours for my data to appear in reports.
Because it takes up to 24 hours for the non-debugview and non-realtime reports to process the data.
Good to know. Thanks for the feedback. By the way, the content on your site is phenomenal.
I'm trying to figure out the best way to setup 'click to call' events for websites... are these really not out of the box? I'm having a hard time believing this is not in one of the groups, did I miss it or do we have to create custom events?
thanks - great work!
This is not out of the box and not among recommended events. Use custom event here.
OK thanks for the info. Strange to me that such an important function is not prepackaged.
Great info as always! Do you have any idea if it's possible to modify the enhanced measurement file_download event parameter file_name? What's being reported is the path of the file instead of the actual file name.
For my old GA download event I built a custom javascript variable to split the click element and return the simple fileName section. It would be great if there's a way to use that instead of messy reporting with the entire path. Thanks for any insight you can provide!
Yeah, sure. Disable file download tracking in enhanced measurement. And track that event on your own (by setting up everything in GTM and GA4 tag)
HA! Of course. Simple and easy. I was busy trying to modify the built-in tracking. Thanks!
For enhanced event tracking (automated one), how can we download the entire event report (like all search term report) instead of just 30 minutes real time one?
Hi, please read the entire guide. The answer is there.
Hello Julius,
I think this is a very useful guide.
But how can I set a custom event in GA4 if I am NOT using GTM?
I mean a click on button event type.
Thanks.
Hi, ask a developer to do that (by followong the GA4 documentation) or learn how to code by yourself.
Since my blog focuses on GTM, that's why I explain only that part.
Sorry, this question might be silly
but I want to as less as possible involve coding or developer
is it possible to fire an event without dataLayer.push code ?
in this article, it looks like i still need a developer to help me put dataLayer.push code to make event happened
does GTM have preset events i can use??
Hi, chapter #4 of this blog post shows an example without the developer's input.
I enabled Enhanced Measurement and Video Engagement and added enablejsapi=1 to my YouTube embed URL whose IFrame is directly on the page. Yet, I still don’t see any video events show up in reporting. How can I troubleshoot this? Note, I am using GA4 via GTM and I didn’t do anything special like using the YouTube trigger. Do I need to?
I personally, still prefer more using Youtube trigger than GA4's youtube tracking. It just covers more situations. So if EM does not work for you, go manual
Thanks Julius. I found my problem. My YouTube embed URL was declared as https://youtube.com/embed/{ytid} instead of https://www.youtube.com/embed/{ytid}. I guess the presence of "www" is important to the events firing, but not to the actual playing of the video. After adding the "www", gtm.video events get fired as expected!
Hi Julius,
really a great and helpful "how to" article.
One question: how to track content groups in GA4? Is this feature still available?
Thanks
It is not available. Use custom parameters for that.
Great write up, thanks for this.
Has anyone seen GA4 lumping everything into Source/Medium Direct even with UTM parameters set?
The same site shows the correct Source/Medium when using Universal GA.
Use "Session source/medium", not "source/medium"
Hi Julius. A slightly mistake in the section #4.1
There is one dash missing in the trigger you wrote in the blog.
Blog: site-nav__link–maind (incorrect)
Trigger: site-nav__link--maind (correct)
I have entered correctly in the admin of the text editor but the frontend changes two dashes into one long dash.
Hi Julius,
Thank you for this clear overview. I have a question about the "recommended" parameters for the recommended events.
At this moment, I send the add_to_cart event (via Tag Manager) to GA4. With this event, I send "item" as a parameter (as recommended by Google). In GA4, I do see the item parameter in the debug view (real time). But when I go to events in GA4, I can't see anything of the items data I send with the event. Should I add the item data (such as item ID, item brand, item category, etc.) as a custom dimension in the Analyses Hub section? I thougt this goes automatically, because it's a standard/ recommended parameter that is recognised by Google?
Thank you,
Sander.
1. Read GA4 ecommerce documentation to properly format the data
2. After the event is sent, wait 24 hours
Amazing article, amazing good job ! Thank you very much :)
Hello, Julius! Thanks for your work -it helps a lot. I'm now struggling to delete some unused events I have made and didn't find a way yet. I see that there is availibility to make some king of Data Deletion Request. Maybe t can help? I know you mentioned "And at the moment, you cannot delete unused events (which is unfortunate). Therefore, be careful about creating too many unique event names." Maybe any updates?
Thank you!
No updates
Why have they made tracking a simple contact form submission so complicated.
how do you track thing if you're using a universal analytics code on analytics 4?
Hi, I migrate GA4 to GTM and then do the implementation. It's more flexible and more powerful. It's time to move away from hardcoded setups.
Its the best tutorial about GA4 and GTM, I was tired of searching spanish documentation before I found this. Congratulations!
Hi Julius,
Thanks for the explanation but i have a "doubt" that is still not clear for me.
When using GA4 and enable Enhanced measurement do i still need to create TAGS in GTM ? As i understand and see the data is available in GA4 or do i miss something. I dont understand why create a TAG in GTM for example track outbound links as it looks like it is there now as default? Or is there a different ?
Thanks
You don't need to create tags for events that arw already automatically tracked by GA4
Hi Julius, thanks for the quick reply. I checked the video again and on one point you remove the click from Analytics configuration and setup the same in GTM so that why i was confused.
Thanks for info
Hi Julius,
First, thanks for the blog.
I have 2 questions, I'd hope you can help me:
1. I would like to understand what it is the main difference between 'view_search_results'event (enhanced measurement) and 'search' event (Recommended)?
2. Although EE is enabled, I can't see the 'view_search_results'event in my debug mode? What can be possible reasons?
Thank you
1. Sounds like a bug/inconsistency on the GA end
2. Thousands of things could have gone wrong. It's difficult to give a solution without seeing the actual situation. Maybe your website is not designed to support that feature, maybe you did something incorrectly. https://www.analyticsmania.com/post/track-site-search-with-google-tag-manager-and-google-analytics/
Hi Julius,
Thanks a lot for your great tutorials. Following them i experiment SAAS product analytics with it and get pretty good results
I just have one main issue with custom event analytics with GTM / GA4: they are
1. I implemented an event following step by step your tutorial (event when clicking on one CTA of our application)
2. In GTM everything is running great : the event is fired once when clicking with all the parameters
3. In GA4 events is fired, counted, parameters are fully ok BUT THE EVENT IS HITED TWICE in GA 4 ??
Checking more in details in the 2 hits there are few differences with parameters/ value : request number (value is different), engagement time (value is different), system property (not available in one hit).
Do you have any explanation / helps to solve this problem ?
According to google research it seems to be a commun issue but not solution finded...
Hi Mathieu,
I have exactly the same problem. Everything works fine, tags and triggers are correctly installed. However, I get all these events twice in GA4. Have you already found a solution?
Or Julius, do you maybe know how this happens and how we can solve this?
Kind regards,
Sebas
Hi Mathieu,
It's me again, I found the solution on the internet. This works for me:
"EDIT: I finally have the solution!
If you created the event within GA4 and then sent it over via GTM then it gets sent as an event twice, you only have to do it in GTM, not also create it in GA4.
So go to Events >> Create New Event >> then locate the event and delete it - GTM will create it automatically from the tag.
I hope that helps?
Sophie"
https://webapps.stackexchange.com/questions/152009/why-is-google-tag-manager-click-event-received-twice-in-google-analytics-4
Great article. THanks so much. Question...
In universal GA, we can track "events" (i.e. every single event interaction) and "unique events" (i.e. aggregated events within a single session).
In GA4, I only seem to be able to see "events" and not "unique events". Is that correct?
THanks
Yes, I am also worried about the lack of such a "unique events" metric.
You can only look at the uniqueness of events through the User, but it also will not tell us as much as "unique event".
THanks
Does GA4 provide any support for tracking page printing, or do we need to do something like this, still? https://www.analyticsmania.com/google-tag-manager-recipes/print/
No built-in support. You will need to adapt that solution you shared i the comment.
Hi Julius, I'm using select_item to track clicks on products and I would like to use something similar to track click on categories (products belong to categories).
For this, I created a custom event "select_category" which reuses most of the parameters of the "select_item".
The event is being tracked but I can't see the ecommerce parameters in my explorations.
I tried creating a custom dimension for the "items" array, but I still can´t see my event parameters. Do you know what I´m missing?
Thanks!
Hi, Julius. Thanks for share. What happen in GA4 if I change the tag names in GTM? Is necessary change the event names in GA4 or not? Also, what happen with the data of this events in GA, it reset to zero for this changes? Thanks. Regards from Peru.
Tag name in GTM has no impact on data in GA4 or anywhere else
Thanks, Julius, and sorry, I wrote bad, I mean event name inside the tag in GTM, what happen if I change this in GTM. Regards.
Then all *new* events will have that new name.
Thanks, Julius!
Hi julius..
Nice piece.. exactly what i am looking for..
I am a newbie with digital marketing and has very little knowledge with javascript.. i am dealing with multiple login method (email, facebook and google account) for my signup page. How do i go about capturing the signups.. thanks so much..
Ask a developer to push login info to the data layer.
Hey, I am currently setting up the measuring for our new GA4 domain parallel to the current UA (2 different page views, one to UA and one to GA4). So far so good. Enhanced measurement seems to work, I can see the events in the live debug view.
It gets frustrating when trying to send more (recommended) events like for example view_cart. I built myself a specific items variable for view_cart from the dataLayer values I got and when I am viewing the cart on our page and send an event via console that triggers the GA4 view_cart event it gets sent to the debug view including all parameters pretty nice.
But it doesn't work with a regular trigger, no matter if I set the event tag to fire when reaching the cart page in case of a page view, DOM ready or window loaded. The event gets shown in the Tag Assistant window, I can see it in the console but it's not reaching GA4. Only when I manually activate the event via console push command it works.
Any idea if I am missing the obvious?
I know where my problem is coming from/related to: the Google Consent Mode. Recently I was launching the feature with the help of a Google support member and was familiar with the gcs parameter. I now realized when debugging for another time that the gcs was set to 100 on all my additional events, which made no sense since I allowed Analytics and saw a gcs of 101 for the other events.
I now simply paused the consent mode tag and relaunched the preview. And suddenly the events keep coming in.
Will investigate this at some other point since the consent mode is optional experience for us atm, but maybe someone else can be helped with this.
Hi there, thanks for all the information and great tutorials!
I was wondering how can I use "click element" instead of "click class" to track clicks? Because on my site there are no "click class" variables for menu links. I can see them as "link clicks" with the "click element" info but not the "click class". Thank you!
You need to learn CSS selectors to use the click element
Hi Julius, in "Create new events (in the GA4 interface)" section you used two parameters for the trigger: "event_name equals page_view" and "page_location contains thank-you".
Is the "page_location" parameter alone note enough? Is there any specific reason you used "event_name" as a mandatory parameter?
There can be many events that happen on a particular page. Without event_name you will match too many events.
Thanks!
Hi
I'm fighting with a problem regarding custom events in GA4, and I can't find info about it in your excellent guide above.
I have set up a number of custom events in GTM, where som are supposed to be marked as "Conversions" in GA4's Configure/Events view. Now, the problem is the custom events created in GTM don't show up in GA4 until they are triggered at least once. And before they are available in GA4 I can't mark them as conversions.
Is there any way to manually declare events in GA4 already created in GTM before any interaction with the events have been performed?
Yes, go to Admin > Conversions and enter events there
Julius, as always, excellent practical clear guide. I used this article to set up the GA4 events tracking for out company.
In the case of measuring the thank you page, are two parameters necessary? with page location is enough?
Are you talking about "Create event" feature? No, page location is not enough because many different events can fire on that particular location.
If you already have events set up in Universal Analytics, do you need to change the code on your website for it to be tracked in G4?
If you use GTAG, I highly recommend it. If you use an older GA tracking code, it is necessary.
This is a very clear and helpful guide! Thank you for putting this together.
I’m having trouble seeing an event I created in GTM in the Explore report. I called this event “internal_link_click and it measure all clicks on the site. I can see this event populate in real-time and also in the reports section. However if I want to view more data around this event in the explore section, it doesn’t appear at all. Any idea of what could be wrong here?
Hi, make sure at least 24-48 hours have passed since you sent the data. Also, select the correct date range in explorations, make sure the report does not have filters.
Hey Julius,
Thanks for this guide but I'm missing something.
When click tracking in UA, I could nest all menu item clicks under the same category, 'menu'. That way, I could keep everything neat and tidy.
Is there a way to do the same with GA4 events? I can't figure it out?
Thanks
Just send the event called "menu" and then send a parameter with that event link_url
Hey Julius,
Is the Device category parameter sent by default with every event even the custom events? I cant find any information on that but i do see the information in GA4 but i didn't set in anywhere.
Thanks
Yes, it's tracked automatically by the GA4 tracking code
Hey Julius, I was wondering if we modified event, how can we delete or disable the modification. It seems the option doesn't exist in GA4. Thank you in advance for your advise!
Go to Admin > Events > Modify event > open the rule > Click three dots > delete
Hi Julius,
Page_view and file_download is already in enhance measurement but parameter is not enough for my requirement so can i create with the same name of custom event and page_view and file_download will be still enable in enhance measurement.
Can you create a change log for when you make changes. I see you make frequent changes - which is great - but I'd love to quickly see the updates. Thanks.
No, I don't plan to do that. My ga4 courses have change logs but my blog posts won't
Thank you very much for this blog post.
By far this is the best guide and it's much better than the official documentation
Thank you so much!