How To Create Custom Events In GA4

A custom event in GA4 is an event you define to track interactions that automatic, enhanced measurement, or recommended events do not cover. You can create one in three ways: from the GA4 admin interface without touching code, with a Google Tag Manager GA4 Event tag, or by adding a gtag() function to your site's JavaScript.

This article walks through each method, the naming rules you must follow, and how to test your events in DebugView before relying on them in reports.

When You Need A Custom Event

Google Analytics 4 collects many interactions automatically. Automatically collected events include first_visit, session_start, and user_engagement. Enhanced measurement events track scrolls, outbound clicks, site search, and video engagement. Recommended events cover common ecommerce and engagement actions like purchase, login, and sign_up. If the action you need to measure is not among these, you need a custom event.

A custom event is an event you define to collect information about an interaction that matters to your business. Examples include a donation, a file rename, a new feature interaction, or a visit to a confirmation page. Before you create a custom event, check the list of automatic and recommended events to make sure one does not already exist. Using an existing event is always better because it populates standard dimensions and metrics.

Sometimes the action is partially captured by an existing event. For instance, a pageview is recorded automatically, but you want to track only views of a specific confirmation page. Instead of writing custom code, you can generate a new event from the page_view event in the GA4 interface (see Option 1). You can also mark any custom event as a key event. There is no limit on the number of custom events for web data streams, but for apps the limit is 500 distinct events per user per day.

Option 1: Create An Event In The GA4 Interface

If the event you need can be derived from an existing event, you can create it directly in the GA4 admin panel without changing your website code. This method works when you want to fire a new event based on specific parameter values of an event that is already being collected.

Click path: Admin then Data display then Events then Create eventAdminData displayEventsCreate event
Matching conditions for a new event in the GA4 interface

To generate a new event:

  1. In Admin, under Data display, click Events.
  2. Click Create event, then Create.
  3. In Custom event name, enter a name that follows the naming rules (for example, confirm_signup).
  4. Under Matching conditions, specify one or more conditions. For a confirmation page, you might set "event_name equals page_view" and "page_location contains /thank-you". Use operators without "(ignore case)" for case-sensitive matching.
  5. Leave Copy parameters from the source event enabled to include the original event's parameters.
  6. Optionally, in Modify parameters, you can add, change, or remove parameters. For example, you could set a static value for a parameter or copy a value from another parameter using double brackets like [[other_parameter]].
  7. Click Create.

You can create up to 50 events this way and modify up to 50 existing events. Modifications take an hour or more to take effect and do not apply to historical data. To modify an existing event, use the Modify event button instead. Be careful when modifying Google-provided events: if you narrow the scope of page_view, it will stop collecting data from other pages. In that case, creating a new event is safer.

Modified events execute in the order listed in the Event modifications panel. You can reorder them if one modification depends on another. Note that you cannot modify events sent via Measurement Protocol, nor can you generate events based on item-scoped parameters (like item_brand) when using gtag.js.

Short on time? Analytics Art can check this in your property for you.

Option 2: Send It With Tag Manager

Google Tag Manager gives you a no-code way to send custom events based on user interactions like button clicks or page views. You configure a GA4 Event tag and a trigger that tells Tag Manager when to fire the tag.

Click path: Tags then New then Google Analytics: GA4 Event then Event NameTagsNewGoogle Analytics: GA4 EventEvent Name
GA4 Event tag in Google Tag Manager with custom event name

Here is how to set up a custom event for a newsletter signup button:

  1. Open your Tag Manager container at tagmanager.google.com.
  2. Go to Tags and click New. Name the tag (for example, "GA4 Event - Signup newsletter").
  3. Click Tag Configuration and select Google Analytics: GA4 Event.
  4. Enter your Measurement ID (find it in GA4 under Admin > Data streams; see where to find your measurement ID).
  5. In Event Name, type your custom event name, like signup_newsletter. This name will appear in your GA4 reports. For a recommended event, use one of the predefined event names.
  6. Optionally, add Event Parameters to send extra data. For instance, add a parameter named method with value web.
  7. Click the Triggering box, then the + icon to create a new trigger. Name it (e.g., "Trigger - Signup newsletter").
  8. Choose a trigger type. For a button click, select All Elements under Click, then Some Clicks, and set the condition "Click Text contains Sign up for the newsletter". For a page view, use Page View instead.
  9. Save the trigger and the tag.
  10. Click Preview to test your setup with Tag Assistant. Enter your website URL and click Connect. Perform the action and verify the tag fires.
  11. Once verified, click Submit and then Publish to push the changes live.

After publishing, you can see the event in the Realtime and DebugView reports in GA4. If you need to reuse the same parameters across multiple tags, look into reusing event settings in Tag Manager.

Option 3: Send It With The Google Tag

If you work directly with the Google tag (gtag.js), you can send custom events by calling the gtag() function in your page's JavaScript. The call must come after the Google tag snippet, because Google won't process data from events placed above the Google tag.

The basic syntax is:

gtag('event', '<event_name>', {<event_parameters>});

For example, to send a custom event when a user completes a tutorial:

gtag('event', 'tutorial_complete', {'tutorial_name': 'Introduction to GA4'});

You can place this code directly in a <script> tag on the page, or inside a JavaScript function that runs on a button click or other user action.

Event names must be 40 characters or fewer. Each event can carry up to 25 parameters. Parameter names are limited to 40 characters, and parameter values to 100 characters, with a few exceptions: page_title (300), page_referrer (420), and page_location (1,000). If you exceed these limits, Analytics drops the extra data.

To test events from your own browser, add 'debug_mode': true to the event or to the config command. Then use the DebugView report in GA4 to see the events as they arrive. Remember to remove debug_mode when you are done; setting it to false does not disable it, you must delete the parameter entirely.

Naming Rules And Reserved Names

Custom event names must follow a set of rules. If a name violates these rules, Google Analytics will not process the event.

  • The name must start with a letter.
  • It is case sensitive. Signup and signup are treated as two different events.
  • It cannot be a reserved name. Automatically collected event names such as first_visit, session_start and user_engagement are reserved; check Google's reserved names list before you pick one.
  • The name must be fewer than 40 characters. If you mark an event as a key event and its name exceeds 40 characters, the required _c suffix cannot be appended, and the event will not be reported as a key event.
  • The name cannot be blank.

Parameter names also have a 40-character limit, and parameter values a 100-character limit (with the page-related exceptions noted earlier). Before you finalize a name, review the events already collected in your property to avoid unintentional duplicates. Make sure your event name complies with the event naming rules, including starting with a letter, avoiding reserved names, and being fewer than 40 characters.

When you rename an event via the Modify event feature, the original event name is replaced in all future data. If the original event was marked as a key event, the renamed event will not retain that status; you must mark the new name as a key event separately.

Testing In DebugView

DebugView is the fastest way to confirm that your custom events are being collected correctly. It shows events in real time as they arrive from your browser or device.

First, enable debug mode. For your own device, the easiest method is to use Google Tag Assistant or the Preview mode in Google Tag Manager. These tools add a debug parameter to your site URL automatically. To enable debug mode for all users, add 'debug_mode': true to your gtag config command or set the debug_mode field to true in your Google tag in Tag Manager. Only include the parameter on the events or config you want to monitor; to disable, remove the parameter entirely, setting it to false does not turn it off.

Once debug mode is active, go to Admin > Data display > DebugView. The Seconds stream (middle column) lists events from the last 60 seconds; click any event to see its parameters. The Minutes stream (left) shows circles for each of the last 30 minutes; click a circle to load events from that minute. The right column displays Top Events and Current User Properties for the selected device. If multiple devices are in debug mode, use the DEBUG DEVICE dropdown to pick the one you want to inspect.

Keep in mind that events will not appear in DebugView if you have implemented client-side privacy controls or if consent mode blocks analytics cookies. Also, filter out developer traffic after testing so your debug data does not mix with production reports.

Frequently Asked Questions

How To Create An Event In Google Analytics 4?

You can create an event in three ways: use the GA4 interface under Admin > Data display > Events to generate a new event from an existing one, send a Google Tag Manager GA4 Event tag with a trigger, or add a gtag('event', ...) call to your website's JavaScript. Each method lets you define a custom event name and parameters.

How Many Custom Events Can I Create In GA4?

For web data streams, there is no limit on the number of distinctly named custom events. For app data streams, the limit is 500 distinct events per user per day. Automatically collected events and enhanced measurement events do not count toward these limits.

What Is The Character Limit For GA4 Event Names?

Event names must be fewer than 40 characters. If you mark an event as a key event and the name exceeds 40 characters, the appended '_c' will be missing and the event will not be reported as a key event. Parameter names also have a 40-character limit.

How Do I Check GTM Events?

In Google Tag Manager, click Preview to launch Tag Assistant, which shows which tags fire on your site. In GA4, go to Admin > Data display > DebugView to see events as they are collected in real time. You must enable debug mode first via Tag Assistant or by adding debug_mode:true to your configuration.

How To Set Up Event Tracking In Google Tag Manager?

Create a new GA4 Event tag, enter your measurement ID and event name, and add any optional parameters. Then create a trigger (e.g., All Elements click with a condition like Click Text contains 'Sign up'). Preview your changes with Tag Assistant, then publish the container.

What Are Custom Events In Google Analytics?

Custom events are events you define to track user interactions that are not covered by automatically collected, enhanced measurement, or recommended events. You choose the event name and parameters, and you can mark a custom event as a key event to track conversions.