Friday, September 24, 2021
No menu items!
HomeData Analytics and VisualizationHow to Track Events with Google Analytics 4 and Google Tag Manager

How to Track Events with Google Analytics 4 and Google Tag Manager

Updated: August 9th, 2021

When Google Analytics 4 was introduced, it was announced as the event-based analytics tool where everything is an event. A pageview, a purchase, etc. And there are many things to know about them that eventually materialized into this blog post and a video tutorial.

Today, I will show how to track events with Google Analytics 4 and Google 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 a behemoth. It includes many valuable things and tips that are almost 8000-words-long. And every artificially inserted paragraph would just 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

+ Show table of contents +

Video tutorial
Upgrading to Google Analytics 4
Changes compared to Universal Analytics (GA3)
4 categories of events in Google Analytics 4
#1. Automatically captured events
#2. Events tracked via Enhanced Measurement
#3. Recommended events
#3.1. Example of a Recommended Event: login tracking

#4. Custom events
#4.1. Example of a Custom Event: Menu Link Click Tracking
#4.2. Register custom definitions

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?
“Reports → Engagement → Events” report
Exploration 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. So if you want to learn the ins and outs of this topic, it’s recommended to consume both formats of the content.

IMPORTANT: some parts of the Google Analytics 4 interface have changed (compared to the video below).

You will find All Events section in Configure > Events
Conversions are in Configure > Conversions
Engagement reports are in Reports >Engagement
Analysis Hub is now called Explorations

 

Upgrading to Google Analytics 4

Before we continue, I have also created a blog post and a Youtube video about upgrading to Google Analytics 4. If you are reading this blog post in 2020 and 2021, then you should take a look here as well.

In that tutorial and video, I explain things like:

Should you upgrade now
Should you use JUST Google Analytics 4 (and get rid of the previous version)
How to upgrade to GA4

But if you are reading this tutorial in 2022 or even later, then you don’t worry about upgrading to GA4 (because it, most likely, be your main Web Tracking platform).

 

Changes compared to Universal Analytics (GA3)

Note: if you don’t care about Universal Analytics, skip to this chapter.

Compared to Universal Analytics, a.k.a. UA (the previous Google Analytics version), the data model in Google Analytics 4 is much more flexible. This means that there are fewer restrictions and required fields/parameters compared to the UA.

The most notable difference regarding events is 4 parameters that you could send together with every event to Universal Analytics (excluding custom dimensions):

Event Category (required)
Event Action (required)
Event Label (optional)
Event Value (optional)

And when you open the Universal Analytics event reports, you’d first see the Event Category. Then you can click it and drill down deeper (to see action and then label).

In Google Analytics 4, the naming convention is much more flexible and it solely depends on the person who is implementing the tracking setup.

In GA4, there is a parameter called Event Name, and then everything else depends on what you have planned. If you wish, you can send no additional parameters. Or you can send 4 additional parameters that better describe the context of that event. For example, let’s say that someone filled in the “Request demo” form on your website. You could send the following event:

Event name: request_demo
product_nameamazing product
company_size99-250
company_industry: internet and telecom
annual_revenue: 50-100M

The last 4 items in the list above are custom parameters that you can send together with an event. However, keep in mind that there are some limits regarding the number of custom parameters that you can send with a single event. I will mention them additionally later in the blog post.

While you can come up with any events you want, there are some recommendations that you should follow. But first, let’s take a look at 4 categories of events in GA4.

If you are not sure how to name/structure your events, I will give you hints later in this blog post + a spreadsheet template. But first, let’s learn about various types/categories of events in Google Analytics 4 and how you can create/modify them. I believe that it’s important to have a good understanding of events in GA4 before we start thinking about the structure.

 

4 categories of events in Google Analytics 4

In GA4, events can be split 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

In the upcoming chapters of this blog post, I will explain where to look and how to find the category of your event. And once you get more familiar with 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 I am mostly focusing on web tracking, the same principle will apply to this guide. There are certain events that GA4 tracks automatically. You can find a full list here. On that list, you will find both app and web events. In fact, the list of web events is a bit longer than I’d expect. Enhanced Measurement events are also listed there.

For now, let’s temporarily ignore them and focus only on those events that are automatically captured and should not be added to any other event category. 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 one is a bit more mysterious. I could not find 100% accurate information about this event. But it looks like 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. I will update this part once I find more information.

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 use Enhanced Measurement. It is designed to 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)

If you want, you can disable/enable events individually and you can do that by clicking the gear icon in the Enhanced Measurement section and then clicking toggle buttons.

Also, some events can be customized additionally. 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 is an event for the outbound link click (when a clicked link redirects a visitor to another domain. Together with this event, an additional parameter outbound (with value “true”) is sent. The event with this parameter means that there was an outbound link click. Together with this event, a bunch of other parameters is sent: link_classes, link_domain, link_id, link_url.

If your business operates on several domains, you can 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_resultsThis event will be sent to Google Analytics 4 if the page loads and the URL of the page contains a query parameter, such as q, s, search, query, keyword. But if you want, you can include more of them (up to 10).

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). If the URL of the search results contains more useful parameters, you can include them as well.

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 is capable of tracking 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, there are many other 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. Currently, it is not possible to update the list with other extensions in the GA4 interface.

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 properly.

 

#3. Recommended events

As I have previously mentioned in this blog post, when you are trying 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 events cover your case, take a look at the list of recommended events. Google has published several pages for different industries:

Generic (for all properties)
Retail/Ecommerce
Jobs, education, real estate
Travel
Games

Check every one of those lists and see if any of the events match your need.  For example, if you want to track when a user logs in, then you will find the “login” event in the list of “All properties”.

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 their recommend events when it makes sense to you. That should help Google Analytics’ reports better understand your data and apply it in their Machine Learning capabilities. However, I still don’t know what are those capabilities (at least in late 2020).

Also, for the majority of those recommended events, Google also recommends some parameters. Speaking of the login event, there is a method parameter. If users can log in to your website via email, google login, facebook login, etc., then it might make sense to track the method as well.

 

#3.1. Example of a Recommended Event: login tracking

Let’s continue with the aforementioned login example. 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 are they using.

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 value of the loginMethod should be replaced with the actual login method that a user used. That is the developer’s job to write custom code that replaces it.

When a developer implements that code and I successfully login, in GTM’s preview mode, I should see the following Data Layer event (see the screenshot below). Now, keep in mind that this event 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 exactly 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 create a Google Analytics 4 event tag. With it, we will be able to send the event data to GA4.

In Google Tag Manager, go to Tags > New > Google Analytics: GA4 Event.

Before you do this, I expect that you are already tracking pageviews and you already have a GA4 configuration tag. If you are new to it, read this guide (that also includes a video) to the migration guide. In a nutshell, the GA4 configuration tag is usually responsible for containing your GA4 Measurement ID and some additional configurations (if you have them).

So, when you create a new GA4 event tag, you will need to:

Define the GA property ID (also known as a Measurement ID)
And then event name + parameters

In order to avoid manual work and setting up all the fields/customizations (such as GA Measurement ID) in every tag, you should select your main configuration tag in the event tag.

If you are familiar with Universal Analytics and you used to manage this in Google Tag Manager, the concept of the Configuration Tag is pretty close to the GA Settings Variable. That tag can contain a lot of settings/configurations. If you use that tag in your other GA4 tags, they will inherit the changes.

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 Row , and then enter method in the Parameter Name 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 will need to click on the login event in the Preview mode’s left side and then 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 the 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), then you will also need to use recommended events and follow Google’s strict requirements. Learn more here.

 

#4. Custom events

Eventually, we have reached the last category of events in Google Analytics 4. If you want to send an event and it is not mentioned among the automatically tracked events, Enhanced Measurement, or Recommended events, then you can create 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 your own event 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.

GA4 is completely flexible here. However, there are some limitations when it comes to the maximum length of an event name.  Also, there is a limit of 500 unique event names per client ID (a.k.a. app instance, a visitor/user).

So, 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.

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

First, I need to create a trigger with correct 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.

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. Keep the trigger set on “All link clicks” and save the trigger.

By creating this trigger, we 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 that I could use to distinguish a menu link click. I don’t want to fire my GA4 event tag on any link click. 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! I will 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. Now, it’s time to create a Google Analytics 4 event tag. Go to Tags > New > Google Analytics: GA4 Event. Select your existing GA 4 Configuration tag and 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 of the 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 menu_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, you are free to do that. You can send up to 25 custom 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.

Now, you will need to go 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 GA4reports. 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

This applies to any event parameter that you send to Google Analytics 4. If you want to see/use them in things like Funnel exploration, Free Form, see their reporting cards in standard reports, etc., you must register custom parameters in the GA interface.

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

Click the Create Custom Dimensions button and then enter:

The name of the parameter. You can enter whatever you want. This is just how the dimension will be displayed in your reports. 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 exactly 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)

The process of how conversions (formerly known as goals) are created is different in GA4 (compared to Universal Analytics). It’s enough just to click a toggle next to an event in the Configure > Event list.

But there is one problem. If you toggle the event and mark it as 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 be marked as a conversion.

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 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?

You can either send a dedicated event (with a different name) from Google Tag Manager/Gtag.js, or you can use the Create Event feature in the GA4 interface.

This feature allows you to create a new event based on other incoming events. On the Configure > Events page, click Create Event and then click Create.

Then you will need to enter the name of the custom event. Once again, you can name it whatever you want. Just make sure that the name clearly communicates what it means. 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 are we looking for. When that particular event will be spotted, then our thankyou_page_visit should be created as well.

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 you want to fix it as well, 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).

Take a closer 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 will be able to 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 in 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 Configure section on the left sidebar of your GA4 interface. Then go to Conversions.

Then click New conversion event and 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 Configure > Events page.

 

Modify Events (in the GA4 interface)

If you don’t want to create new events (like in the previous chapter) but instead, you just want to fix a typo in the existing events, you can use the Modify Events feature in the Google Analytics 4 interface.

In my Configure > 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. Even though the count of this event is low, I’d like to fix it.

I can do that by going to the Configure > 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?undefinedit will change its name to page_view.

As you can see, the interface and the flow here is quite similar to the Create Event feature that I have described in the previous chapter of this blog post.

Once you save the changes, you will be able to 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.

By the way, keep in mind that you can create up to 50 modifications per property and that this feature does not apply to historic data. This modification will apply only to new incoming events.

 

Test your events in Google Analytics 4

Once you configure your events, it’s time to test them. The primary feature built for debugging GA 4 data is the DebugView section. You can find it by going to Configure > DebugView on the left side of the GA4 interface. Click it.

That’s the place where your debugging should take the 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 the 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 GA4 Configuration tag and adding the following parameter:

If the debug_mode parameter is set to true, the event will be seen in DebugView. If you are using a hardcoded gtag.js, here are the instructions on how to include 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 and then a list of parameters will be displayed.

Click on that parameter to see the value that was received by GA4. 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, make sure 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 and it might require some time to find yourself. This especially applies to my blog, when many of my readers have enabled the GA Debugger Extension and I have 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, conversions with green. Please ignore the fact that I treat menu_click events as conversions. This is just for demonstration purposes

If you click the event, you will see the parameters that were sent together with an event. Click on the parameter to see its value.

Once you made sure that the data is coming in and it is displayed properly, 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 then complete all the other steps that 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. This is where you will see the data coming into your reports. Unlike in the previous version (Universal Analytics), the new report offers you capabilities to see the data on a much more granular level.

First, you will see a map and a bunch of cards with traffic sources, most popular events, 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. 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, simply press the Exit snapshot button in the top right corner.

 

Where can I find the events 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 that you have just sent to Google Analytics 4.

Keep in mind that at the moment of writing this blog post (late 2020), the built-in reporting capabilities of Google Analytics 4 are still quite limited. Hopefully, that will change soon. Let’s take a look at what we have now. Here are some of the reports:

Configure > 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 that you send (in one way or another). The aforementioned reports 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.

 

Explore (a.k.a. Exploration reports, ex Analysis Hub)

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

Here is an example of a Free Form report. Keep in mind that you will need to wait for 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 that I want to see how different device categories are interacting with the menu bar of my site. Remember, I set up the menu_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 did get each menu URL. Click the Plus icon and then find the menu_item_url dimension. Select it and it will be included in the list of possible dimensions in the report.

If you CANNOT see the menu_item_url (or whatever custom parameter are you 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. Remove 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 wish to see. I used the Event Count.

Then you will need to filter only to those events that actually contained the menu_item_url dimension. In my case, that is just a menu_click event. That’s why at the bottom of the Tab Settings section, you should enter a filter: Event name exactly matches  menu_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 times were they clicked.

Also, don’t forget to change the date range if you need it. You can do that 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 be just an overview of how you should do it. Hopefully, in the future, I will write a dedicated article just for that (once I spend even more time with Google Analytics 4).

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 own values. Just keep in mind that there are some limitations related to the length.

If you have a huge list of event names, be aware of another limitation. Currently, you can have up to 500 unique events per property. If you are close to that limit in your spreadsheet, maybe it would make sense to combine some events under the same event name and introduce an additional property (currently, the limit of registered custom properties are 50 text properties and 50 numeric properties. More about registered properties – later in this post).

Here is an example of the spreadsheet with events that you could prepare yourself and then try to pick the right naming convention. You can use it as an example/inspiration to come up with 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 do you want to track together with them
The second one is a list of parameters with their explanations

The first sheet:

In column B, you can just briefly describe an event in plain English
In column A, you should enter the name of the event 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. It looks pretty clean to use this principle to name the event, e.g. event_name (all lowercase and connected with an underscore). Event names like “Submitted the Form” will also work, but the all-lower-case-with-underscore looks cleaner (I believe that the term snake-case applies here).
Column C is for type (is it Automatically collected, Enhanced Measurement, Recommended or Custom?).
Column D is for parameters that you want/plan to track with particular events. I did not include default parameters that are 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 blindly follow it. If you wish, you can take just some parts and adapt it to your needs.

Once you prepare the plan, then 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

Another thing to keep in mind that there are some limits (and some are gone (at least for now?). 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). In Universal Analytics (free account), the allowed limit of hit per property was 10 million. At the current moment, there is no such limit in Google Analytics 4. But you never know what might happen in the future
You can have up to 500 unique event names per property (Enhanced Measurement events are not counted). So if you have an event called login and also Login, these will be counted as two unique event names. I’ve noticed some people saying that recommended events are not counted towards the 500 limit (and that they heard this from Google’s support). I have also spoken with many people, including Charles Farina and he confirmed that recommended events are counted towards the 500 event limit.
You can have up to 50 custom dimensions and 50 custom metrics registered in a property. The keyword here is registered. This means that you have to go to Configure > Events > Manage custom definitions and have them configured there. If you send more custom parameters but they are not registered, you’re fine.
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 useful:

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 length of the blog post is just proof of that. And the almost-one-hour-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 naming recommend names and parameters.
If none of the recommended events match your need, then create a custom event

Here are some of the key takeaways of 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, 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 cannot be larger than 500 (per visitor/user). Enhanced Measurement events are not counted in that 500-limit.
You can send custom parameters (dimensions and metrics) with events (both recommend 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.
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)
If you are thinking about migrating your Universal Analytics events to GA4, don’t just blindly reuse Event Action, Category, and Label fields. It’s time for you to rethink your naming convention and parameters.
There are some other limits as well (regarding the length of names/parameters, etc.)
Use Google Analytics 4 DebugView to test the incoming events on a granular level.

Got more questions about how to track events with Google Analytics 4? Post them in the comments below!

 

The post How to Track Events with Google Analytics 4 and Google Tag Manager appeared first on Analytics Mania.

Read MoreAnalytics Mania

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments