Google Analytics 4 Events

In the context of migrating from Universal Analytics (UA) to GA4, it is crucial to understand the different nuances between the two versions. In this article, we will explore how the event structure has changed from UA to GA4, and how to configure events in the newer version. Events can be forwarded to GA4 in two ways: By using Google Tag manager, or by creating them directly in the GA4 interface. We will also explain both methods in detail.

Changes compared to Universal Analytics

One of the most noticeable changes is the flexibility of GA4’s new data model compared to that of its predecessor. In UA, the structure of an event was pretty much defined. You forward 4 parameters with every event, however there are some restrictions that apply

  • Event category (required)

  • Event action (required)

  • Event label (optional)

  • Event value (optional)

When skimming through the events report in UA, the first parameter you would see is the event category, then you drill down all the way to the value.

However, an event name in GA4 can be whatever you want it to be. And you can forward many more parameters that might describe the context of that event in a better way.

If we are tracking the purchase event for example you would expect a following structure

  • Event name : purchase

  • Transaction_id : “9209”

  • Value: 100

  • Currency: EUR

  • Items: “name of product/list of products purchased”

We will talk more about event parameters and what are some of the recommendations that Google suggests for naming conventions. For now, let’s start discussing the four different event categories in GA4

Event categories in Google Analytics 4

In GA4, there are four event categories:

  • Automatically collected events

  • Enhanced Measurement events

  • Recommended events

  • Custom events

1. Automatically collected events

  • 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

2. Events tracked via Enhanced Measurement

The introduction of enhanced measurement event tracking in GA4 is a noticeable improvement from the previous version. When enabled, GA4 will automatically track most of the events that need manual configuration in UA (Actually only pageviews are automatically tracked in UA). It was implemented to help GA4 users get as many common events tracked as possible without the need to cooperate with developers. You can access those events by going to Admin — Property —  Data streams

 

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 clicks (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)

page_view. This event is forwarded to GA4 each time a new page loads or when the URL of the page changes without reloading the page.

scroll This event is forwarded to GA4 once per page when a visitor scrolls below the 90% threshold of the page height.

click this event is for outbound link clicks. (when a click leads the user away from the current domain). Together with this event, a bunch of other parameters are forwarded: link_classes, link_domain, link_id, link_url.

view_search_results This 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, given that your internal site search uses a different parameter than the ones already setup as default (up to 10).

video_start, video_progress, video_complete Enhanced Measurement is capable of tracking interactions of embedded Youtube videos on your website and then sends those video events to GA4. However, these embedded videos should contain ?enablejsapi=1 parameter in their URL which is not always present on websites. Therefore tracking video engagements with this metric can be tricky and needs some tweaks as well. Our recommendation is to track video engagements using 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. Technically if the link opens or downloads a file, it will be tracked

In case you would not like to track enhanced measurements, all you have to do is switch the blue toggle off. Or if you would like to select some of those events, press on the gear icon (settings icon) choose the events you’d like to track and press save.

3. Recommended events

Whenever you want to create and name an event (and it’s parameters) check first what the first two categories provide in terms of events. If you don’t find the event you want to create in there, head to the recommended events. Google has provided events that are recommended to have on your website (whether generic website events, Online sales events, or even gaming events) to check the full list click here

As we have previously mentioned, the data model of GA4 is very flexible, allowing users to create and name events the way they find suitable. However, if you find an event from the recommended events section that makes sense to you and your business, configure your event using the same naming convention that GA4 provides. (e.g. if you want to track the login event on your website, GA4 recommends you create an event named login with the parameter method. This helps Google to better understand your data and implement it in their machine learning capabilities (you can create a login event named logged_in, or logging_in, or any name you like. However it’s better to stick to GA4’s naming conventions)

4. Custom events

Finally, we have the last and most important event category. In our opinion we find this category to be the bread and butter of event tracking. Whenever you want to track an event that is not caught by either the automatically tracked events, enhanced measurements, or recommended events, you go for custom events. In other words, you could track a very specific event that occurs on your website that is essential for your business, but at the same time cannot be tracked by default.

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 the menu navigation bar, the name of the event can be any of these:

  • menu_click

  • menu_item_click

  • navigation_click

Or anything else. Google recommends naming your event with the “snake case” naming convention that consists of only small letters (no capitalization) divided by an “ _ ”

So, following up on the menu clicks example, let’s have a look at how to set a custom event that tracks a certain navigation menu item.

Example of a Custom Event in GA4: Menu Link Click (configured through GTM)

 

Let’s take our own website as an example to explain how to configure a tag in Google Tag Manager that fires whenever a menu bar item is clicked. When you head to www.wearekemb.com you can see the following section as our navigation bar 

 

Let’s say we would like to track those menu items whenever each one of them is clicked.

Let’s start slowly, and define each step in the process.

  • We know that clicks are automatically tracked with enhanced measurements, however in this specific case we want to track specific clicks that have specific “identifiers” that differentiate the menu bar clicks from different clicks on your website.

  • In order to pinpoint those clicks, we need to send all the possible parameters that could be forwarded with a click event in order to have a better look at what can be used to identify certain clicks. (like click classes, click ID etc…)

To do that, in our GTM container, we need to head to variables — built in variables — Configure

And make sure that all click variables are selected for them to be forwarded with every click event.

  • Then, we need to create a trigger with the proper conditions that will distinguish the clicks in question. In order to do that, we need to preview the GTM container to see what is happening whenever one of those menu items is clicked. After all the click variables are enabled, and before previewing, either

    1. refresh the gtm container and THEN press the preview button,

    2. publish the changes you have done to the workplace and then press the preview button (refrain from using step 2. It is much more convenient to publish the changes AFTER testing all of them first)

PS: Whenever a change is made to the container you have to do one of the two steps mentioned above in order to see it in the preview mode. 

  • After selecting the preview mode, one of the menu items is clicked. And that should be reflected in a “link click” event since it is automatically tracked.

And indeed we can see the link click event right there!
There are no tags set up yet, and this is what will be our goal in this example: To fire a GTM tag whenever a menu click event occurs.

 

  • We dive deeper by looking at what are the variables that were present in this event. After clicking on variables, we see the following

  • By enabling the click variables, we can notice two identifiers we can work on,

    1. The click class

    2. The click text

So in other words, a menu link click on our website has this specific click class, and we can see that the menu item that was clicked was the “blog” item. It is stored in the variable {click text}

 

  • We’ll try a second menu item click and see what will be pushed to the container.

We can see that the click class is the same for another menu item, and we notice that the item “jobs” was selected

So we can think of it this way, the menu items in the navigation bar all have the same click class but obviously different names. So how do we know which item was exactly clicked? And which one was clicked the most?

Now comes the fun part! Let’s create our tag.

First, let’s head to the trigger section in our GTM workspace and create a trigger that will fire a tag on a specific link click. After setting up the conditions, press save.

Second, after creating a trigger, let’s create a tag that will fire upon the trigger we just configured, let’s head to the tags section of our workspace and press NEW. 

 

  • We create a GA4 event type tag because this is an event we would like to track

  • The configuration tag should be the GA4 configuration (The measurement ID) with which you are tracking your website  (as you can see we selected menu_click as a name for the event, and as previously mentioned it can be whatever you want it to be)

  • As we saw previously, since all of the menu clicks have the same class, instead of having a tag for each individual item, we could have the tag we are currently configuring and forward with it an event parameter we will call “ menu_item_click” that will be equal to the “click text” variable.We expand the Event parameters, click add row and fill it in with menu_item_click as the name of our parameter, and by clicking on Insert Variable button we assign the value of the parameter as {Click Text}.
    Event parameters are meant to more clearly describe the context of the event (in our case, it will give us an idea of which menu item was clicked). We will see how they are forwarded and seen in the GA4 interface later in the article)

  • This is the trigger we previously configured, (when a click that has the click class we specified, it will fire the tag we just created)

  • Finally, we press save, and refresh the container so that we can see our changes in the next preview.

Now let’s check if the tag we configured is properly firing. We do the previous steps done before, and we should see a tag firing whenever I press a menu link.

And there we have it!

Now, we need to move to Google Analytics 4 to check the DebugView in order to test what we have configured. Let’s head to the Configure section and press on DebugView.
This is where the debugging happens. Remember, GTM preview shows you which tags are being fired, and in Debug mode you get to see if what you have configured in those tags is being properly forwarded to GA4.

There are many ways to enable debug mode in GA4.

  • Enabling GTM’s preview mode will automatically set the debug_mode in GA4 to true

  • Forwarding debug_mode parameter with the GA4 configuration tag or with any event you wish to see in the DebugView

  • Enabling the GA debugger extension on your chrome browser

Following on our example, we will proceed with the first option

So if you enter the DebugView without initiating the preview mode, this is what you will see.

When you enable the preview mode you will be redirected to the following window

This is where you insert your website’s URL, and connect to it.

Tip

Before enabling the preview mode in Google tag manager, make sure to install the Google tag assistant extension on your browser. It will facilitate the debugging process When you want to connect to your website, a new tab will be opened (and not a window, making it more convenient for work)

You will see the confirmation from the extension, that the connection was indeed successful

After connecting to our website, we clicked on menu items and viewed the pages, we then headed to the DebugView in GA4 and this is what we saw.

Pretty cool, right? This is where we will see all of the events happening in “almost”real time. (Sometimes there might be a delay between doing certain actions on your website and seeing them in GA4.)

 

  • We see that we have one “Debug Device” connected (in contrast to 0 in the previous picture). So the connection was indeed successful. You might see more than one device connected if someone in your team also has a debugview opened for example, the number of devices connected will be 2.

  • After clicking on the website, we can see that those menu item clicks were indeed forwarded to GA4. When you click on any event in the DebugView you will be able to know more details about it.

For both menu item clicks, we notice that among the automatically forwarded parameters,  the event parameter we configured earlier with the menu_click event is being properly sent to GA4 showing different menu items. First one was the Jobs item, second one was the Blog item.

However we are not done just yet!
Even if you still see those custom parameters here in the debugview, you will not be able to use them in your GA4 reports unless you configure those parameters as custom dimensions. By doing so, you can then use this custom dimension as a secondary dimension in your GA4 reports, or as primary dimensions in explorations reports.

Let’s get to it.

In your GA4 interface, head to the Configure section  Custom Definitions — Create custom dimensions

  • Dimension name can be whatever you want. This is the name that will appear in your reports. For this example, we named it Menu Item name

  • Since we are dealing with a single event, and not every event by done the same user (you have two scopes, event and user) we select the event scope

  • This step is optional, however recommended for better understanding

  • If you remember, we have set up a specific name for the parameter we forwarded. In order to view it as a custom dimension in GA4, the name of the parameter should be exactly the same as configured.

    PS: You can see that we didn’t write the entire name of the event. GA4 directly recognized the parameter in question in the dropdown menu. However don’t worry if you don’t see it in the dropdown menu. Sometimes GA4 takes up to 24 hours to register the custom parameter.

  • Finally, you press save and as mentioned, the custom dimension might take up to 24 hours to appear in reports

Now that we have configured a custom event in GTM, let’s create new events in the GA4 interface.

Creating events in the GA4 interface

 

For this section, let’s try to create a different event.

Say that we want to track the (that has a specific URL like https://www.website.com/thank-you/ ) that appears after a visitor signs up to your newsletter. You can do that through GTM obviously, however for this example, we will configure the event directly from your GA4 interface.Head to Configure — Events — Create event

 

You will be redirected to the following page.

You can see that the structure is quite similar to the one we saw in Google Tag Manager. Basically in GTM we set up triggers that will fire a tag that will track the event and forward it by choosing GA4 as the configuration of your tag. Here however,since we are creating the event directly in GA4, we just have to identify triggers or matching conditions that will create an event.

Let’s go over what we have filled in

  • The event name. As previously mentioned in this article, this is completely up to you but it is better to stick to the “snake case” naming convention.

  • The first matching condition. So remember, we want to track the thank you page. So we first want to track the pageview itself. Therefore we want the event name to be equal to page_view because that’s the name GA4 reserves and uses for this event. (Check the previous screenshots of the DebugView  and see how the pageview event is sent)

  • The second matching condition. Which pageview do you exactly want to track? For that reason, we specify that the page location (or URL) should contain this “identifier” which in our case is the “/thank-you/ parameter

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

  • When you are done configuring the event, press Creat.

And there you have it! you have just configured an event directly in the GA4 interface.

Now, if we want to configure this event as a conversion, all we have to do is switch the “mark as conversion” toggle to on and from that moment, GA4 will register this event as a conversion.
Pretty easy right? and much better than configuring goals in UA

Closing notes

 

This was a lengthy article! However, we hope we have provided you with valuable information and a clear explanation of how to configure events in GA4. Let’s summarize what we have discussed in this article, and add to it some of the limitations that you should know in GA4

  • Whenever you want to create an event, start by gradually checking the first 3 categories we discussed (automatically tracked events, enhanced measurments, and recommended events) and if none of those categories (especially the recommended events) contains the event that you want, then you must create a custom event

  • There are two ways of configuring events and forwarding them to GA4, either configure a GTM tag that will fire upon a trigger and will forward the event, or create the event directly in the GA4 interface

  • Remember to register your custom parameter as a custom dimension in GA4 if you would like to use this parameter in your reports.

  • To test your tracking setup, head to the DebugView section in GA4, (after enabling preview mode in GTM) and check whether all the events and parameters are being properly forwarded.

Limitations you should know

  • You can forward up to 25 parameters with an event

  • There is a limit of 50 custom dimensions, and 50 custom metrics per property.

  • You can have up to 500 unique events property.

Latest Posts

Are you facing similar challenges?

We would be happy to discuss ways we can best assist you. Do not hesitate to book a free consultation at a date of your choice!