Custom events in Google Analytics are a powerful way to track what is important for your business. In reality, you can use 1 of the 3 other types of GA4 events. Sounds confusing? Read on because in this article, I will explain when and how to integrate custom events in your measurement strategy.
- GA4 custom events are a powerful way to track what is important to your business.
- Before you set them up, check if automatically collected events, enhanced measurement events or recommended events can track the data for you.
- Like recommended events, custom events have limitations.
- You can set some custom events up in GA4 directly.
- Others, you will have to set up with Google Tag Manager.
- Always test your custom events.
- Set up custom dimensions to see the data in GA4.
If you'd rather watch than read here are a few ideas for custom GA4 events:
If you'd like to explore the ways that enhanced measurement events can be.. well, enhanced even more:
What is a custom event in Google Analytics 4?
You can create a custom event in GA4 to track information on your site that is valuable for your organization, but not tracked automatically. You can create some custom events directly in GA4 and others with Google Tag Manager.
Visually presented, custom events in GA4 need these ingredients:
A name, optional parameters, a trigger and custom dimensions.
Before we get to the details, let’s look at a metric that may be useful to know.
Our page with programs for data-driven marketers has a chat box. For our visitors, this is an excellent way to address our team.
We, on the other hand, want to know how many people actually use the chat box. And here is the thing: although the chat box tool itself has statistics, it is super handy to track this too in GA4.
Google Analytics is a hub where you can collect data from every single action a visitor does on your site, or app
There are many chat box solutions and GA4 doesn’t track this automatically, so we have to set up a custom event.
If you look at your site, you will for sure easily identify plenty of visitor actions you would like to track.
Before you do anything else, first ask yourself whether you really have to go through the effort of setting up a custom event?
Tired of Stumbling Through Your GA4 Data? 😞
Learn 10 surprising things GA4 can do that will save you time (and impress your friends).
When do you need to set up a custom event in GA4?
GA4 has 4 event types: automatically tracked, enhanced event measurements, recommended events and custom events. You only need to set up a custom event of none of the other types offers you a way to track user actions on your site.
All events show up in the events report. So, what’s the difference between them, anyway?
Let me rephrase the question to make it a bit more interesting: why are there even different events in GA4?
Your website and ours are different. And yet, they also have a lot in common.
They both have, for example, web pages. And you and we want to know which web pages were visited because they help us both understand what the audience is interested in.
Your site may not have a chat box, like ours. For GA4, there is no point in tracking things that don’t exist on every site.
- Automatically collected events: these are useful for all websites and apps. You cannot switch them off, but you can screw them up. Here is the list of all these events. Examples are:
- language: this is the language setting of the browser of the visitor and hence, absolutely useless for multiple language site tracking.
- Enhanced events: you can configure GA4 to collect data for you. If needed, you can still customize these events. The complete list of these events is here. Some examples are:
- Recommended events: these are events that are useful for many sites, but you need to configure them. The complete event list is here. These are some examples:
- For all properties: login
- For online sales: add_to_cart
- For games: level_up
- Custom events: if none of the above 3 event types fits your needs, you can create a custom event. But, there are limits…
Limitations of custom events
The following limitations apply to GA4 custom events.
Naming conventions GA4 custom events
- Your event name can consist of 40 characters maximum. If you use more, you won’t be able to mark it as a conversion. Btw, that’s the equivalent of a Universal Analytics goal.
- You cannot use any of the event names of automatic, enhanced or recommended events. This may be tricky. For instance, the event name “click” refers to clicks to other sites and not to tracking clicks on your site.
- Your event names must start with a letter and contain only letters, numbers, and underscores. Spaces are not allowed. It is best practice to only use small characters. This is the so-called snake case. For example: click_chatbox_button.
Limitations of custom event parameters
Parameters are additional values that you want to pass with your event. You can, for example, track a button and show in GA4 on which page the button was clicked. In all cases, take the following limits into account:
- You can send 25 parameters per event.
- The name of the event-parameter is limited to 40 characters.
- If you pass a value, the length can be 100 characters maximum.
Finally, time for some real action…
How to set up a custom event directly in GA4?
In GA4, you can use all 4 types of events as a basis for your new event. Even if you have created a custom event before, you can create another one based on it directly in GA4.
In the example below, we will create a custom event every time somebody visits a page that has “thank-you” in the URL.
Step 1: In GA4, go to Configure > Events and click on Create Event.
Step 2: In the next screen, click on Create Event.
Step 3: Fill in the Custom Event Name field.
Take the limitations mentioned above into consideration; for example:
Step 4: Alter the matching conditions of your event.
In this example, we are in fact using the page_view event as the basis for our customized event. You can see this in the first row.
The second row contains page_location as a parameter. GA4 triggers the event every time somebody visits a URL that contains “thank-you”.
Step 5: Optionally, you can copy the parameters of the original event.
If we leave this checked, all the parameters of page_view will be passed to the event in GA4.
You can also change the parameters and, e.g;:,
- assign a value of “20” to this particular event
- and add a currency, such as “dollar”.
This would be handy if you earn 20 dollars on average every time the event happens.
Step 6: Click on the blue Create button.
On the next screen, you will see a summary of the custom event you created.
Nice, but did all go as planned?
How to test custom events in GA4?
Once you have configured a custom event directly in GA4, you need to test it. If you mis-configured it, it won’t show up at all in GA4. In the other case, it may take 24 hours before you can see it.
That’s how long it takes for Google Analytics to update. (this link is not live yet)
Step 1: Visit your site
Try to replicate the custom event you have configured in GA4. That can be: visiting a page, filling in a form, clicking a button…
Step 2 In GA4, go to Reports > Real-time
Please note: this shows visits from the last 30 minutes, so make sure you do this quickly after step 1.
Step 3: Scroll to the event card
If all went well, you will see your custom event.
That was easy. Although setting up custom events in GA4 is easy, it is not always possible…
How to set up a custom event in GA4 with GTM?
It is impossible to explain in one step-by-step guide to set up all sorts of custom events in GA4. But in all cases, you need to create an event name and a trigger in Google Tag Manager. Optionally, you can also configure parameters.
Again, let me give you a simple example which can hopefully serve as inspiration for you. Let's assume you want to track the click on a specific link on a web page. It could also be a link a with mailto email address.
Step 1: Create a new Tag in Google Tag Manager.
Important: you need to have GA4 configuration installed in GTM, otherwise this won’t work.
Step 2: Give your Tag a descriptive name.
This is only for GTM and you can use spaces and uppercase.
Step 3: Click on the Tag icon.
Step 4: Choose Google Analytics: GA4 Event as tag type.
Step 5: Select “None – Manually Set ID” from the Configuration Tag dropdown list.
Then paste your GA4 measurement ID in the field.
Step 6: Fill in the name of your custom event.
This time, you need to use lowercase and underscores. GA suggests you use recommended event names, but for our example, we are using a custom name.
Step 7: Optionally, you can add all sorts of configurations, such as event parameters.
Step 8: Add a trigger to fire the event.
Step 9: Configure your event trigger.
In our case, we use Some clicks and the CSS class of the hyperlink as the condition.
Your developers can help you with this, or you can right click on the link and then click on Inspect.
You can then find the value for the CSS class, provided it exists.
Step 10: Save your trigger configuration.
It is useful to give it a descriptive name too for future reference.
Step 11: Review your custom event and save it.
You will now see your freshly created custom GA4 event.
But again, does it do what you want it to do? Let’s find out.
How to test custom events in GTM?
Before you publish a custom event you created in GTM, you better test it. These are the steps you need to follow.
Step 1: Click Preview in GTM
Step 2: Fill in your URL and click Connect
Your site will open in a new tab of your browser.
In GTM, you will see a message that says your site is connected:
Step 3: On your site, perform the actions to trigger the event you created in GTM.
This can be, for example, a click on a URL, as described above.
Step 4: In GTM, open the debug view and see if your custom event is listed under the fired tags of the GTM container.
Step 5: In GTM, also double check your GA4 container.
Check that your event is listed here too.
Step 6: Publish your GTM container to your site.
You can best fill in the submission configuration details before you hit the Publish button.
That was it. Or was it?
How to see custom events in GA4?
Creating custom events is only part of the work. To see them in GA4, you need to create custom dimensions.
For the examples of the custom events in this article, this looks as follows in GA4.
Then you can find your custom events back as custom dimensions in your reports and exploration reports.
On behalf of the Data Driven U team, I sincerely hope this article will help you better understand what visitors are doing on your site to move the revenue needle of your organization.