Google Analytics 4 - Visualization of Event Data

Learn how to track and visualize user events in GA4 with powerful, actionable insights using Looker Studio.

Ceyhun Enki Aksan
Ceyhun Enki Aksan Entrepreneur, Maker

Google Analytics 4 - Event Management article covers GA4 events and the parameters associated with them. In this article, I’ll walk through the planning of a sample event and demonstrate how to visualize the collected data using GA4 and Looker Studio.

warning

As of July 2023, Universal Analytics (UA) is being phased out in favor of Google Analytics 4 (GA4). After this date, UA properties will no longer be able to process new data. They will eventually become inaccessible, likely by year-end. For more details on differences between property types and other operations, please refer to my article Universal Analytics (UA) to Google Analytics 4 (GA4). You may also request technical support at (https://calendly.com/dnomia/15min).

GA4 provides us with the ability to track events and various parameters specific to each event. Additionally, we can create new events by leveraging existing parameters associated with current events, and we can also designate existing events as conversions1. In the following example scenario, I’ll base my explanation on a form structure composed of several steps.

Planning Events

Suppose we have a form with different features as shown in the example below2. We want to measure which steps of the form users complete and how many form submissions are made as a result of user interactions.

GA4 - Event Organization
GA4 - Event Organization

In each scenario (let’s call them A, B, and C), a Form Submitted event is triggered when the user completes a step. If the registration process is successfully completed (i.e., no duplicate records and the provided information is valid), a conversion tag is triggered and the user is redirected to the Thank You page1.

However, at the Form Submitted stage, intermediate steps can be presented to the user based on the information provided by them. Thus, our first conversion (Form Submitted) is considered, while secondary conversions are treated as intermediate actions that the user is directed through.

If we simplify this flow into a flowchart:

[mermaid] flowchart LR A(Selections) —>|Next| B(Personal Information) B —> |Next| C(Questionnaire) C —>|Condition 1| D(Form Submitted) C —>|Condition 2| E(Image Upload) E —> D C —>|Condition 3| F[Payment] F —> G[Thank You] D —> G [/mermaid]

At this stage, two distinct paths can be followed:

  • Defining a separate activity for each step
  • Defining all steps under a single activity using parameters to differentiate them

The first approach enables the execution of operations based on individual activities. One or more of these activities (such as form submissions, payments, etc.) can be marked as conversions. In the second approach, since only one activity name is defined, it would not be logical to mark this single activity as a conversion. In this case, we can create a new activity in GA4, define its name and parameters, and then designate this new activity (and any other required activities) as conversions. I anticipate that the process may appear a bit complex; therefore, we will proceed step by step.

Activity Control

The visualization process may take some time depending on the data source and the nature of the activity. Therefore, it is advisable to proceed with a timeline that accounts for potential delays—up to 48 hours on BigQuery and up to 24 hours on GA4.

GA4 - Events
GA4 - Events

On the GA4 side, it’s quite easy to view event details through the reports mentioned above. On the BigQuery side, however, depending on data volume, we may need to write SQL queries. You can review the SQL queries listed below.

Do not forget to adjust the table path in the format domain.analytics_123456789.events_20211011 according to your own data source.

SELECT event_name, COUNT(event_name) AS val_occurrence 
FROM `domain.analytics_123456789.events_20211011`
GROUP BY event_name
ORDER BY val_occurrence DESC
LIMIT 10;

The output of the relevant SQL query will resemble the following:

Rowevent_nameval_occurrence
1page_view984
2session_start965
3user_engagement763
4first_visit670
5scroll286
6funnel42
7funnel_step_128
8click16
9funnel_step_210
10video_progress8

Now, let’s list only the events containing ‘funnel’.

SELECT event_name, COUNT(event_name) AS val_occurrence 
FROM `domain.analytics_123456789.events_20211011`
WHERE event_name LIKE '%funnel%'
GROUP BY event_name
ORDER BY val_occurrence DESC
LIMIT 10;

Assuming the result of the example SQL query is as follows:

Rowevent_nameval_occurrence
1funnel42
2funnel_step_128
3funnel_step_210
4funnel_step_38
5funnel_step_46
6funnel_step_54
7funnel_step_62

The most fundamental difference between GA4 and BigQuery is that the BigQuery table contains timestamps (labels) whenever a specific event is triggered3. Thanks to these timestamp labels, we can calculate the time elapsed between events and perform actions accordingly. Of course, you can also process these timestamp labels as parameters. It would be more appropriate to evaluate such details based on the specific context.

For example, you can examine the incoming data using the SQL query below:

SELECT event_date, event_timestamp, event_name
FROM `domain.analytics_123456789.events_20211011`
WHERE event_name LIKE '%funnel%'
LIMIT 5
Rowevent_dateevent_timestampevent_name
1202110111633984748349537funnel
2202110111633984883567678funnel
3202110111633984883567678funnel
4202110111633984883567678funnel
5202110111633984883567678funnel

Multi-Event Usage

First, let’s break down each step as a separate event.

gtag("event", "funnel_step_1");
//...

Name one or more of these events as conversion events and visualize the collected event data using both GA4 and GDS.

Our events should look like this for each step:

StepEvent NameTitleFlow
1funnel_step_1SelectionsA,B,C
2funnel_step_2Personal InformationA,B,C
3funnel_step_3QuestionnaireA,B,C
4funnel_step_4Form SubmittedA,B,C
5funnel_step_5Image UploadC
6funnel_step_6PaymentA
7funnel_step_7Thank YouA,B,C

Visualization of Multi-Event Usage with GA4 and GDS

Together with GA4, templates such as funnel and path under Explore are now available for one-click usage. This enables users to easily view interactions on their website and apps, and evaluate the collected data within audience segments. In this article, we will visualize the relevant events by following the Explore > Funnel Exploration steps.

On the GDS side, I recommend using a bar chart.

GA4 - Funnel Exploration
GA4 - Funnel Exploration

First, let’s go over the relevant steps again. For this purpose, clicking the pencil icon next to the Steps header is sufficient.

GA4 - Funnel Steps
GA4 - Funnel Steps

On the Edit funnel steps screen, the following actions must be repeated for each step: Add step > Add new condition > events > funnel_step_x>. For the “Thank You” step, the page_view event can be selected, and the path value of the thank-you page can be specified as a parameter.

GA4 - Pageview Event
GA4 - Pageview Event

Breakdowns can be made by device category (device category) and similar selections. After these operations, the funnel will take on a form similar to the example shown below.

GA4 - Funnel Exploration - Steps
GA4 - Funnel Steps

After this stage, new segments can be created via the steps, and/or existing segments can be examined based on events.

GA4 - Step Segmentation
GA4 - Step Segmentation
GDS: Reporting - 1

On the GDS side, if events are organized in a planned manner, simply using filters is sufficient to create a table and bar chart.4

For tables and/or charts, when the dimension is set to Event name and the metric to Event count, the events specified in the format funnel_step_x will be sorted by their occurrence count. If we wish to define custom labels for these events, we will need to use the CASE function5. We can achieve this by creating a new field (create field). The following SQL snippet will suffice for this operation.

CASE
WHEN Event name='funnel_step_1' THEN 'Step 1'
WHEN Event name='funnel_step_2' THEN 'Step 2'
WHEN Event name='funnel_step_3' THEN 'Step 3'
WHEN Event name='funnel_step_4' THEN 'Step 4'
WHEN Event name='funnel_step_5' THEN 'Step 5'
WHEN Event name='funnel_step_6' THEN 'Step 6'
ELSE NULL
END

This process can also be implemented at the chart and/or report level.

GDS Funnel Visualization
GDS Funnel Visualization - Table & Bar Chart

If there are null values in the table and/or chart, you can exclude them using filters. For events starting with funnel_step, you can again create a filter to restrict the events based on the event name4.

You can also use the page_view event within the CASE statement, although this will prevent you from handling null values.

--...
WHEN Event name='page_view' AND REGEXP_CONTAINS(Page path,'success') THEN 'Thank You'
--...

Therefore, I recommend defining these values as a separate event using the event name and parameter value.

Event and Parameter Usage

In this step, we will use parameters under a single event and will modify the events to be marked as conversions via GA4. As before, we will visualize the data we’ve obtained using both GA4 and GDS.

Custom Metrics and Dimensions

We can define parameters passed within an event as metrics or dimensions by following the Configure > Custom definitions steps. At this stage, we need to define a scope (scope) for the relevant definition. For example, when leveraging user properties, we can set the scope to User, and for other cases to Event.

GA4 - Event Modification
GA4 - Event Modification

Since we need a custom dimension in this article, we will proceed through the Custom dimension option. The Dimension name specifies how the dimension will appear in reports, while the Event parameter defines which parameter will be linked to this dimension. We can save the dimension definition by selecting step_name as the event parameter.

GA4 - Custom Dimension
GA4 - Custom Dimension

Since we’re performing the visualization process through a single event, clearly defining the parameters associated with each step will be appropriate.

Our events should look like this for each step:

StepEvent NameParameterFlow
1funnelStep_1A,B,C
2funnelStep_1A,B,C
3funnelStep_3A,B,C
4funnelStep_4A,B,C
5funnelStep_5C
6funnelStep_6A
7funnelThank YouA,B,C

The 7th step listed in the table represents the page view action, as previously mentioned under a higher-level heading. Particularly, having the relevant action defined as a separate event within the GDS process will be beneficial.

GA4 and GDS Visualization Procedures Using a Single Event

IMPORTANT RULES:

  1. Maintain the original formatting (markdown, HTML tags, links, etc.)
  2. Keep technical terms and proper nouns as appropriate
  3. Preserve code blocks and technical syntax exactly
  4. Maintain the same tone and style
  5. Only output the translated text, no explanations or comments

You can define a custom dimension by following the Configure > Custom definitions steps without waiting for the event to be logged. This way, the relevant parameter values can be used within the report once they are obtained.

gtag("event", "funnel", {
    step_name: "Step_1",
});
//...
GA4 - Realtime - Events & Parameters
GA4 - Realtime - Events & Parameters

The ability to view parameters within standard reports does not imply that these parameters can be used during the visualization process via the Explore feature.

GA4 - Explorations
GA4 - Explorations
GA4 - Funnel Steps - Event & Parameter
GA4 - Funnel Steps - Event & Parameter

Data obtained during the Explore process is from one day prior. Therefore, data may be delayed depending on the time range. As a result, if the parameter value does not appear during the step creation process, you will need to wait (ensuring the parameter has been properly passed).

GA4: Reporting - 2

When managing GA4 event data through a single event and its associated parameters, after selecting the event within the relevant funnel, you will need to add the parameters using the Add Parameter option next to it.

GA4 - Funnel Steps - Event & Parameter
GA4 - Funnel Steps - Event & Parameter
GA4 - Funnel Steps - Event & Parameter
GA4 - Funnel Steps - Event & Parameter

When the relevant field is clicked, the logged parameters will be listed. If only (not set) is displayed, other activities might not have been logged yet. In such a case, it would be beneficial first to review the date range on which the report’s data is based, and then to examine the activity definitions.

GA4 - Funnel Visualization
GA4 - Funnel Visualization

As the steps are defined sequentially with their associated parameters, the users’ values changing at each stage will be visible at the top.

GDS: Reporting - 2

Since we will be using a single activity definition and dividing the steps via the step_name parameter, we also need to appropriately handle the CASE function.

CASE
  WHEN Event name = 'funnel' AND step_name='Step_1' THEN 'Step 1'
  WHEN Event name = 'funnel' AND step_name='Step_2' THEN 'Step 2'
  WHEN Event name = 'funnel' AND step_name='Step_3' THEN 'Step 3'
  WHEN Event name = 'funnel' AND step_name='Step_4' THEN 'Step 4'
  WHEN Event name = 'funnel' AND step_name='Step_5' THEN 'Step 5'
  WHEN Event name = 'funnel' AND step_name='Step_6' THEN 'Step 6'
  ELSE NULL
END

In the case of multiple activity usage, it is recommended to perform this operation at both the data source and report levels, which will facilitate easier filtering. Additionally, it would be more appropriate to define the page view for the “Thank You” step through a new event rather than the existing page_view event.

Then, we need to update the GDS data source.

Data Source - Refresh
GDS - Connection Change

During the data source update process, existing fields (fields) are listed alongside new fields. As shown in the image, the newly defined dimension step_name is listed under the new fields.

Custom Dimension
Custom Dimension

This means the relevant field is now available for use within reports. Therefore, we can update the CASE function accordingly to match the new activity and parameters.

After updating the CASE function, the steps will be visualized in a table and bar chart, sorted by activity count.

Based on an example form flow, we’ve seen how we can visualize the planned GA4 activity structure both through GA4 and via GDS. In subsequent stages, I will discuss how these data can be utilized in processes such as segmentation and audience definition.

*[GA4]: Google Analytics 4
*[GDS]: Looker Studio

Footnotes

  1. How to Track Conversions with Google Analytics 4 (previously known as Goals) 2
  2. Page Break. Gravity Forms
  3. Events: dimensions & metrics (GA4)
  4. Filter your data. Data Studio Help 2
  5. CASE. Data Studio Help