Jonathan Saipe

9 Ways To Build Custom GA4 Events Without GTM

25 August 2023, Jonathan Saipe

If you’re reading this article, you are probably wondering what your options are when setting up custom events in GA4, either because you aren’t using Google Tag Manager (GTM), or because you don’t have access to it.

There’s no question that having a tag management solution provides more power and flexibility when setting up GA4 events, but in its absence, there are still a surprising number of custom GA4 events you can create within the GA4 interface.

Events allow you to measure a specific interaction or occurrence on your website or app. As GA4 is built around an “event model”, the more events you can add, the richer your data insight will be.

What are the different types of GA4 events?

  1. Automatically Collected Events: events that are collected by default e.g. page_view, first_visit, session_start, user_engagement
  2. Enhanced Measurement Events: events collected when you enable enhanced measurement in your GA4 Property data stream e.g. video_complete, file_download, click, scroll, view_search_results etc
  3. Recommended Events: events that have predefined names and parameters that you can unlock to deepen your reporting e.g. generate_lead, add_to_cart, begin_checkout, view_item, sign_up etc
  4. Custom Events: events that you can define when the above events won’t fulfil your reporting requirements

It’s worth noting that custom events won’t show up in most standard reports, so you will need to set up custom reports or explorations to further your analysis.

Google’s support documentation provides some basic examples of setting up events including a page view event, but we will delve further, illustrating some useful examples and use cases that might help you with your measurement strategy.

Where do I create custom events in GA4?

To create your own event in GA4, you’ll need to visit Admin > Events and click on the blue “Create event” button.

How to create a GA4 event - step 1

Then click on the blue “Create” button to load the configuration screen.

How to create a GA4 event - step 2

In the configuration screen, enter your custom event name alongside the matching conditions below.

How to create a GA4 event - step 3

What are the naming rules for GA4 events?

  • Event names should start with a letter
  • Only use letters, numbers and underscores when naming events. Don’t use hyphens or spaces.
  • Event names are case sensitive, so, news_signup and News_signup will be considered two distinct events.
  • Don’t use reserved event names e.g. page_view, video_start, first_visit, scroll, click, file_download or other automatically or enhanced measurement event names
  • Keep event names to under 40 characters in length

1. Page View Events

Before starting, let’s remind ourselves of the most basic application (which Google’s support documentation uses), namely a page view event.

For example, you may want to trigger an event every time a user arrives at a landing page, or a conversion page, hence triggering a page_view event.

Custom GA4 event using the page view event

In the above example I’m using a recommended event, namely generate_lead which will be triggered when a user arrives at a thank you page, for example, after submitting an enquiry form. However, you can also use your own custom event name.

It’s worth noting that the above method can be prone to duplicate counting if a user repeat visits, or reloads the destination page. However, this can be resolved in two ways.

1. If you have marked this event as a conversion, visit Admin > Conversions, and ensure you change your counting method to once per session, rather than once per event – as below.

Where to change your conversion counting method in GA4

How to change your conversion counting method in GA4

2. Or, as the example below illustrates, you can add an additional parameter of page_referrer, to ensure that the user only triggers the generate_lead event when the user arrives from a specific page e.g. a contact form, rather than landing directly at the landing or conversion page

Custom GA4 event using the page referrer event

2. Click Events

Whenever a user clicks on a link to leave your domain, GA4 will report a click event. For example, if a user finds your social media profile links in your website footer, and clicks to leave your domain, a click event will be reported.

The click event is one of GA4’s enhanced measurement events. Personally I find its name rather misleading, and I would have preferred it to be called something like external_click or outbound_click.

If measuring users leaving your website is important to you, it’s pretty simple to set up a custom GA4 event every time someone clicks to leave your domain.

The example below uses the click event, alongside the parameter link_url to create the matching conditions when that custom event should fire.

You can also use link_domain instead of link_url as an alternative parameter, if you only want to specify the domain rather than the full URL of the link clicked.

Custom GA4 event using the click event

3. Video Engagement Events

If you’re looking to trigger a custom GA4 event based on user’s video engagement across your website, you can use the video_start, video_progress or video_complete enhanced measurement events to set up your custom GA4 event.

As the names suggest, when a user plays a video, GA4 will trigger a video_start event.

As a user progresses through a video, at the 10%, 25%, 50% and 75% marks, GA4 will report individual video_progress events.

And when a user finishes watching a video, GA4 will fire a video_complete event.

If you’d like to set up a custom GA4 event based on video engagement, you can use any of the above events as well as a specific video parameter such as video_title or video_percent to set the matching conditions when your custom event should fire. Let’s see some examples.

Use Case: Trigger a custom GA4 event every time a user watches my corporate video to completion

The example below uses the video_complete event alongside the parameter video_title, to set the matching conditions when the event should fire.

Custom GA4 event using the video complete event

Use Case: Trigger a custom GA4 event when a user watches 50% of my video

The example below uses the video_progress event alongside the parameters video_title and video_percent, to set the matching conditions when the event should fire.

Note that the video_percent parameter needs to contain a value that represents the percentage of the video watched.

Custom GA4 event using the video progress event

4. Page Engagement Events

At some point, you are almost certainly going to want to trigger an event when a user engages with a meaningful page.

The simplest way to do this is by using the scroll event. This is an enhanced measurement event that fires when a user scrolls to 90% or more of the page or screen.

When a user scrolls, you could argue that they are more engaged than users who don’t, and therefore it can be used to measure engagement on one or more important pages.

Use Case: I’d like to fire a GA4 event when a user scrolls on a specific landing page

In the example below, we use the scroll event, alongside the page_location parameter, to set the conditions when the event should fire.

Custom GA4 event using the scroll event

Use Case: Trigger a custom GA4 event when a user scrolls on any pages containing blog, news or about in the URL

In this example, we are also using the scroll event and page_location parameter. However, we are also using a regular expression to add more flexibility to the matching conditions.

Rather than using “contains” as the operator, the “matches regular expression” operator allows us to add more than one value; the pipe or | symbol represents “or” in this case.

Custom GA4 event using the scroll event with regex

5. File Download Events

If measuring file downloads, such as PDFs, are important to you, you may well want to trigger a custom event when a specific file such as an annual report, datasheet or terms and conditions are downloaded by users.

When a user downloads any file site-wide, the file_download enhanced measurement event is triggered by GA4.

Use Case: Trigger a custom GA4 event when a user downloads my annual report

In this example, we’ve set up a custom GA4 event using the file_download event with the link_url parameter, to set the matching conditions. This allows us to specify the URL of the file users are downloading.

You can also use the file_name parameter instead of link_url, if you know the exact name of the file the user has clicked on.

Custom GA4 event using the file download event

6. Page Value Events

If you’ve monetised your website and you are triggering purchase events with value as a parameter, then you can create a custom GA4 event based on the total purchase value, or even a specific item purchased.

For example, you might want to trigger an event when users purchase specific items that are meaningful to you, or when the value of that purchase is over (or under) a certain amount.

Use Case: Trigger a GA4 event when users spend over £500 on my website

In this example, we are triggering a custom event using the purchase event and value parameter as the matching conditions. Note that the value field doesn’t require any currency symbols.

Custom GA4 event using the purchase event and page value parameter

Use Case: Trigger a custom GA4 event when users purchase a specific item on special offer

In this example, we are triggering a custom event using the purchase event and item_name parameter, as the matching conditions to specify the exact product the user purchased.

Custom GA4 event using the purchase event and item name parameter

7. Search Results Events

If you have a keyword search function on your website, enhanced measurement will take care of reporting visitors’ searches, as GA4 will trigger the view_search_results event whenever a search is made.

You may however want to trigger a custom event when a user enters a search query that’s important to you.

E.g. if someone searches for “help”, “contact”, “telephone” or “address” – maybe they’re having a hard time finding pages or content to get in touch, and it’s important that you are alerted of that fact.

It also shows that the user has intent, and you could create GA4 audience of users who triggering that event, and retarget the same audience via Google Ads.

So how do we do it?

Whenever a user carries out a keyword search, the view_search_results event is triggered. GA4 then collects the search query using the parameter search_term. You can therefore specify the search query or queries that will trigger a custom event.

Use Case: Trigger a custom GA4 event when a user searches for a specific keyword

In the example below, the custom event is triggered when the view_search_results event is fired alongside the search_term parameter when they include the search terms “Tel”, “Telephone”, “Phone” or “Contact”.

Custom GA4 event using the view search results event

Note that we are using a regular expression with the | (or) symbol, and that the regular expression operator is set to “matches regular expression (ignore case)” to account for users typing either upper or lowercase letters.

8. Traffic Filter Events

The custom event I’ve recently toyed with uses the traffic_type GA4 parameter.

If you have set up GA4 filter rules, you may remember that the traffic_type field allows you to name the type of traffic visiting your website and match it to an IP address.

Often GA4 admins will call the traffic type something like, “internal” or “developer”. But you can also be more creative than that. For example you might want to call it the name of your office location, team or supplier.

When you create a filter using that traffic type, you can set the filter state to “testing”, which allows you to see those users in your reports e.g. by using a report filter and using the dimension Test data filter name.

However, you could also create a custom GA4 event that will fire whenever that particular traffic type visits your website.

In the example below, we’ve used the page_view event and traffic_type parameter as the matching conditions. It means that whenever a user with a specific traffic type e.g. “developer”, visits a page, your custom event will fire. Neat eh!

Custom GA4 event using a filter traffic type value

9. Audience Trigger Events

An alternative way to create custom events in GA4 is by using an audience trigger.

Audience triggers let you fire a custom event when users match your audience definition and become a member of that audience.

Here are some use cases of audiences that could trigger a custom event.

  • Users from a specific geolocation who engage with a specific page
  • Returning users within a specific time period e.g. 7 days
  • Non-converting users e.g. checkout abandoners
  • Users who trigger a specific purchase event over a certain value i.e. “high value users”
  • Users from a specific campaign name or source/medium combination who engage with certain pages

How do I create an audience trigger event?

Rather than creating events the standard way in Admin > Events, visit Admin > Audiences instead.

Once you’ve defined your audience, on the right-hand side of the interface, you’ll see “audience trigger”, with the option to “create new” below it. Simply name your event in the pop-up and save it.

Using a GA4 audience to trigger a custom event

How many audience triggers can I have in GA4?

You can create up to 20 audience trigger events per GA4 property. And you have a limit of 100 audiences per GA4 property.

A Final Word About Events With Regex

Remember that you can use regular expressions (regex) when creating GA4 events, which will give you more flexibility and power.

Do note that when you create an event in GA4, users need to fulfil all the matching conditions you add. It’s therefore easy to make mistakes when setting up custom GA4 events.

See incorrect example below

In this example, the event won’t fire as we’ve set too many page_location parameter matching conditions that need to occur. (A user can’t trigger a page_view on two pages simultaneously, so the event won’t be triggered).

Example of incorrect use of regex in GA4 events

See correct version using regex

This example will work as we are using a regular expression operator to define the conditions. In the value field, we’ve added /blog|/news, meaning that the event will fire when the URL contains either /blog OR /news.

Example of the correct use of regex in GA4 events

The above isn’t intended to be a complete guide to GA4 and regular expressions, but it should highlight some easily made mistakes to avoid.

I hope these GA4 event examples provide some useful guidance. These should keep you busy for now!

This post was written by Jonathan Saipe, Founder of Emarketeers. Jonathan leads Emarketeers’ GA4 training course and GA4 migration service.