Preloader Close

BLOG

Google Analytics 4 Event Tracking: How To Get Set Up

Google Analytics (GA4) events tracking can be challenging to set up compared to UA – we've got you covered with this comprehensive guide.

Universal Analytics is being sunset, and everyone is rushing to migrate from UA to Google Analytics 4 (GA4).

In this guide, we’ll help you migrate your custom events and walk you through how to set up GA4 custom events.

Types Of Events That GA4 Automatically Tracks By Default

Google Analytics 4 automatically tracks several events by default, without any additional configuration. Some of these events relevant to web property tracking include:

  • click.
  • file_download.
  • form_start.
  • form_submit.
  • page_view.
  • scroll.
  • session_start.
  • user_engagement.
  • video_complete.
  • video_progress.
  • video_start.
  • view_search_results.

It also collects the following parameters by default:

  • page_location.
  • page_referrer.
  • page_title.
  • screen_resolution.
  • language.

But in most cases, it is not enough for comprehensive tracking, and here is where custom event tracking comes into help.

Let’s look at how to set up custom event tracking in GA4.

 

How Does Google Analytics Event Tracking Work?

When you perform an action on a website or in the app, GA4 sends requests with detailed information about your activity, called events (formerly “hits” in Universal Analytics).

After receiving those requests, GA4 processes the submitted data, aggregating and organizing it to generate meaningful reports and insights.

How To Set up Custom Event Tracking Manually In GA4

First, I would like to share one of the most powerful sides of GA4: You can create custom events by using other events which meet certain criteria.

Navigate to Events in GA4 and click the Create Event blue button in the top right corner.

In the dialog, you can set criteria for when your new custom event should fire.

Here, we created a “newsletter_sign_up” event on the page_view event when the page_location parameter contains “newsletter-confirmation” in the URL (as you read above, GA4 tracks these by default).

Based on your newsletter thank you page URL specifics, it can be different.

And what is even cooler: you can turn that event into a conversion and track sign-ups as conversions.

Pretty easy, isn’t it? This is one of the wonders GA4 brings with it; no coding skills are needed to make this magic happen.

You can use this feature in a bunch of different scenarios. But if you run into a situation where this is still not enough to meet your needs, you might need to set up events with custom parameters.

Below we will discuss advanced techniques for setting up custom events.

How To Set Up Custom Event Tracking With Custom Parameters In GA4

In Universal Analytics, there are four parameters for events you can track, and there is no option to add more parameters:

  • Event Category
  • Event Action
  • Event Label
  • Event Value

In GA4, there is no longer such a structure, but it comes with more flexibility, as you can define as many event parameters as you want.

The advantage is that you get highly customized event tracking with lots of data, but the downside is that it’s no longer a plug-in-and-play like UA.

Configuring custom event tracking in Google Analytics 4 (GA4) requires several steps.

In order to track events with custom parameters in GA4, you have to start by adding custom dimensions, and there are two ways of doing that: gtag and GTM-based.

First, we’ll discuss gtag-based implementation. If you prefer GTM-based, you can skip this first section and read that part below.

For implementation, follow the step-by-step guide below.

How To Add Custom Dimension In GA4

Navigate to Admin > Property > Custom definitions.

Click the Create custom dimensions blue button and create an event-scoped custom dimension by entering the dimension name and event parameter.

For our guide, let’s start with custom events tracking analogical to Universal Analytics with custom parameters.

  • Event Category
  • Event Action
  • Event Label
  • Event Value

Suppose you want to track clicks on your main navigation menu.

In this case, you could set the Event Category to Menu Clicks, the Event Action to the anchor link, and the Event Label to the anchor text.

example use case for this setup is to change the anchor text of menu items and track which ones attract more clicks, allowing you to optimize your navigation menu for better user engagement and conversion rates

Per GA4 documentation, you should trigger a gtag event when one clicks on your menu items (we assume links are inside the
  • html tag, which have .menu-item class). You can see the example code below.

    The event name “menu_clicks” can be anything you want, and it will have three parameters you provide. This is one approach if you don’t have Google Tag Manager and prefer gtag implementation.

    You can use custom parameters to pass additional values to predefined events, for example, sign_up event. Per GA’s documentation, it supports only one parameter called “method” ( which can be anything, e.g., social login, email, etc. )

    By adding custom dimensions, you can also pass additional information such as sign-up subscription plan (for example, “free trial,” “basic,” “premium.”)

    You can add custom dimension”sign_up_plan” and pass along with “method.”

    To implement all these, you need basic JS programmer skills, which you can quickly learn by using ChatGPT. You can now test the prompt:

    Try this prompt, and you will see the magic happening.

    You can copy and paste that code into your CMS code editor, and voila!

    Now, let’s set up the same event tracking using the GTM tag.

    I assume you’ve already installed GA4 via Google Tag Manager and will proceed with the steps from there.

    You would need to add custom dimensions per the steps explained in the section above.

  • We’d love to help you

    Please feel free to get in touch using the form below. We'd love to hear your
    thoughts & answer any questions you may have!
    Itctrls location

    Hyderabad

    • 105, Flora Apartments,
      Road No - 3, Banjara Hills, Hyderabad - 500 034.
    s