Know & Connect > Handbooks

Google Analytics 4 (GA4) Naming Convention

A handbook for digital leaders and their teams

By Dim Stoyanov, a founding partner of Know & Connect and the head of our global consulting practice. Dim, who works at the intersection of business and technology, is a technical marketer with 17 years of experience in digital. Before founding Know & Connect, Dim was a VC-backed startup founder who later held digital leadership roles at Fortune 500s. | Write to Dim Stoyanov

Whether you’re in the midst of migrating from Universal Analytics to Google Analytics 4 ("GA4") or setting up a GA4 property for a new digital touch point, custom events will be a key part of your tagging and analytics setup.

Even though Google Analytics 4 collects a number of events for you automatically, no analytics setup can be considered complete without custom events that track not just the basics, but also the activities and conversions that impact your bottom line the most.

Understanding the constraints and best practices

Google Analytics 4 collects a number of events automatically with its enhanced measurement events.

This means that as long as the GA4 tag is fired on your website, you don’t need any additional tagging or extra lines of JavaScript code to capture the data collected through enhanced measurement.

As time- and resource-saving as enhanced measurement may be, brands and publishers may — and very often do — need to collect more than just the bare basics. In such cases, Google recommends that GA4 users use a number of standard names for their custom events, such as login, purchase, search, and others.

Looking at Google's event naming convention for GA4's built-in events like page_view, we can see that:

  • The event names are always lowercased
  • Pairs of adjacent words in a name are separated by an underscore
  • All names aim to be as self-explanatory as possible, describing the action (for example, click, scroll) or the object (for example, ad_impression, error) being tracked

In other words, if you're planning to collect custom events in GA4 and prefer to keep their naming pattern consistent to Google's, consider using snake case.

In a help section article about GA4 event naming rules, Google also provides a number of additional requirements and constraints for naming events:

  • Event names are case-sensitive (for example, Google Analytics 4 treats my_event and My_event as two different events)
  • Event names can include English as well as non-English words and letters
  • Event names must use only letters, numbers, and underscores
  • Event names must start with a letter
  • Event names must not use reserved event names and prefixes

(Note: The list of reserved event names and prefixes can be found in Google's linked-to help section article above.)

Lastly, in an article about GA4 event collection limits, the Google team informs us about the following limitations:

  • Event names shouldn’t exceed 40 characters (event parameters, on the other hand, shouldn’t exceed 100 characters)

The character limits, the Google team adds, are the same for single-width character languages (like English) as well as for double-width character languages (like Japanese).

How to approach your custom events' naming convention

Suppose you were setting up web analytics for a podcasting platform — and you wanted to establish a common pattern and naming convention for the two most basic interactions with the podcast player: plays and pauses.

Naming pattern #1: Using an event parameter to disntinguish events

On the one hand, you can use the event name to create a category of events called "podcast," then use the event parameters to distinguish one event type from the other.

Event Name Event Parameters
podcast podcast_action = play
podcast_progress = 0
podcast podcast_action = pause
podcast_progress = 50
Using event parameters to distinguish GA4 events

This approach will be familiar to those who've tracked custom events in Universal Analytics ("GA UA"), the legacy version of Google Analytics, as the event name will resemble event category parameter from GA UA's event structure.

Organizations that track many events across many categories may want to opt for this naming pattern thanks to the structure that it creates and the taxonomy that such a structure allows them to introduce. It's important to note, however, that this pattern is better-suited for organizations that do their own reporting outside of GA4's reporting UI (for example, in Google's Looker Studio or Microsoft's PowerBI), since the GA4 UI will treat all custom events as one and the same event.

Naming pattern #2: Using event names to disntinguish events

The other option is to use the event name as the unique key for each and every event. Keeping to our example:

Event Name Event Parameters
podcast_play podcast_progress = 0
podcast_pause podcast_progress = 50
Using event names to distinguish GA4 events

Notice that this event has one parameter less because we no longer need to distinguish between one event and the other using the podcast_action parameter — we are capturing the value of that parameter in the event’s name instead.

The biggest benefit to this approach is that it makes it somewhat easier for users of GA4's reporting UI to slice and dice data in reports, since they need to filter for event names and not parameters. A small distinction, but one that can make a world of a difference in large organizations, where users of all experience levels may need to use Google Analytics on a self-service basis.

A key choice to make: actions vs. objects in event names

The names of your GA4 events can be action- or object-first, depending on whether they are descriptive of the action taken by the user or the object being interacted with.

For example, an action-first event naming convention in the case of our podcasting-platform example would result in event names such as:

Event Name Event Parameters
click ux_element = button
ux_element = button_251
play ux_element = media_player
media_type = podcast_episode
media_id = episode_137
media_progress = 0:00
pause ux_element = media_player
media_type = podcast_episode
media_id = episode_137
media_progress = 1:68
An example list of action-first event names for a podcasting platform

An object-first event naming convention, on the other hand, would look like this:

Event Name Event Parameters
button action = click
ux_element = button_251
podcast action = play
ux_element = media_player
media_type = podcast_episode
media_id = episode_137
media_progress = 0:00
podcast action = pause
ux_element = media_player
media_type = podcast_episode
media_id = episode_137
media_progress = 1:68
A counterexample of object-first event names for a podcasting platform

The difference between an action-first and object-first GA4 event naming convention is subtle but important. At the end of the day, the naming pattern of your GA4 events can affect the usability of its data for all users, from ad buyers and digital marketers to operations and analytics teams.

What to remember

When you put all of Google’s rules, limits, and best practices together, you get the following six “commandments” for naming GA4 events:

  • Lowercase your event names
  • Start all event names with a letter, not a number
  • Separate pairs of adjacent words using an underscore ("_")
  • Make sure all your event names are under 40 characters in length
  • Don’t event names and event prefixes reserved by GA4
  • For consistency, use either the name or a parameter to distinguish between events
  • For consistency, use either the action or the object for naming your events