Share this Insight:

This article is the final piece of our three-part series devoted to the new Google Analytics 4. You can read the first article here, and the second here.

As we saw in previous articles about the Google Analytics 4 update, in this new version events become the way in which user interactions will be reflected in the reports, whether they are purchases, downloads, clicks, pageviews, etc. Therefore, what we previously understood as an Event with a Category (an Action and a Label) is no longer the same. Now, there is only the Event Name and parameters that Google has already predefined, or custom parameters that we can create depending on each site and what we want to measure. This provides greater flexibility, richness and relevance in the data.

In order to make the most of the events in Google Analytics 4, and determine relevant conversions in each case, we must have a better understanding of what types of events exist. After defining them, we will detail how to create custom events and how to make them reflect in Google Analytics through Tag Manager. 

Types of Events in Google Analytics 4

First, let’s define the types of events:

  • Automatically collected events: Without going into too much detail, you can see a list of these events on Google's support page
  • Enhanced measurement events: We've seen some of these in a previous article. When creating a data-stream in a GA4 property, these can be chosen, removed or added (e.g., page views, scrolls, outbound links, etc.). You can read more about enhanced measurement events in Google support.
  • Recommended events: Google recommends certain events that you can use and add in your measurement, such as a site login event. Before creating a custom event with a selected name, make sure that Google is not already recommending a similar event type. This will make things easier for you in the long run.
  • Custom events: In cases where, for example, we have a button on the site, or we want to tag a menu or a specific section of a site and there's not already an event for it, we can create custom events.

How to create Custom Events in Google Analytics 4 and track them with Tag Manager

If none of the automatically collected events, nor the enhanced measurement ones–not even the recommended ones–are useful to track a specific interaction you want to measure, with Google Analytics 4 you can create your own custom events without limitation or restriction. Well, technically the maximum number of unique events you can create per property is 500 and, even if there is an event that you're not using (such as document downloads, if you happen to not use that type of interaction on your site), you cannot delete them to add recommended or customized ones.

To explain how to create a Custom event step by step, we will use something that we usually track in the products we deliver in Modyo as an example: our site's navigation menu.

main menu of Modyo website, reads platform solutions company partners resources

1. We need to make sure that our site, our GA4 property and the Tag Manager account are connected, as we described in the previous article in this blog on how to upgrade to GA4 step by step.

2. Since clicks are already something that GA4 is tracking by default, we have to differentiate default clicks from menu clicks. To start, we need to use the Preview mode in Tag Manager, and click on any of the menu items making sure that we have the built-in Click variables selected. In this case, we will click on "Company".

select preview button different types of clicks, shows click element, classes, ID, target, URL and text

3. When we see this Click in the Preview, we need to locate the Element Classes (in this case the menu button).

in menu on left side select link click, picture shows different types of clicks

4. With this information we can create a trigger in Tag Manager with the following configuration:

trigger configuration trigger type reads click - just links

5. Now we can create the tag that will fire with this trigger. Google recommends that the tag event name should be in all lowercase and ideally without spaces, joined by an underscore. In this case, let's use menu_click.

tag configuration google analtyics ga4

6. In this event we can add rows to create different event parameters that will indicate where the click occurred in the menu. Then save the tag.

event parameters choose value click text

7. We can check if the "Link click - menu item" tag is triggering in the Tag Manager preview and publish the tag once we see that it is showing the correct information about the clicked menu link. In addition, we will also be able to check that this event is registering in GA4 through the Real Time report.

One last step for reports in Data Studio and others...

8. In Modyo, we typically add one last setting to these steps, since these events need to be available in Data Studio reports. We need create a Custom Dimension with the name of the parameter. To do this, go to the menu item All Events within Events, look for the blue Manage Custom Definitions button at the top right, and follow the steps to create a new parameter with the same name that we used in the previous steps.

select manage custom definitions button in top right

custom definition shows custom dimensions registered one

Custom Definition to dimensions, select menu_item_name under event parameter name

9. Finally, in Data Studio, open the option to edit the Data Source we're using, click on Edit Connection, and choose Reconnect. Here a window will appear indicating the parameter that we previously created in GA4, and we need to accept this reconnection to finish the process and be able to use that parameter in our reports.

Consulted source: https://www.analyticsmania.com/post/how-to-track-events-with-google-analytics-4-and-google-tag-manager

Photo by Toa Heftiba on Unsplash.