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.
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.
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.
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:
| Row | event_name | val_occurrence |
|---|---|---|
| 1 | page_view | 984 |
| 2 | session_start | 965 |
| 3 | user_engagement | 763 |
| 4 | first_visit | 670 |
| 5 | scroll | 286 |
| 6 | funnel | 42 |
| 7 | funnel_step_1 | 28 |
| 8 | click | 16 |
| 9 | funnel_step_2 | 10 |
| 10 | video_progress | 8 |
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:
| Row | event_name | val_occurrence |
|---|---|---|
| 1 | funnel | 42 |
| 2 | funnel_step_1 | 28 |
| 3 | funnel_step_2 | 10 |
| 4 | funnel_step_3 | 8 |
| 5 | funnel_step_4 | 6 |
| 6 | funnel_step_5 | 4 |
| 7 | funnel_step_6 | 2 |
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
| Row | event_date | event_timestamp | event_name |
|---|---|---|---|
| 1 | 20211011 | 1633984748349537 | funnel |
| 2 | 20211011 | 1633984883567678 | funnel |
| 3 | 20211011 | 1633984883567678 | funnel |
| 4 | 20211011 | 1633984883567678 | funnel |
| 5 | 20211011 | 1633984883567678 | funnel |
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:
| Step | Event Name | Title | Flow |
|---|---|---|---|
| 1 | funnel_step_1 | Selections | A,B,C |
| 2 | funnel_step_2 | Personal Information | A,B,C |
| 3 | funnel_step_3 | Questionnaire | A,B,C |
| 4 | funnel_step_4 | Form Submitted | A,B,C |
| 5 | funnel_step_5 | Image Upload | C |
| 6 | funnel_step_6 | Payment | A |
| 7 | funnel_step_7 | Thank You | A,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.
First, let’s go over the relevant steps again. For this purpose, clicking the pencil icon next to the Steps header is sufficient.
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.
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.
After this stage, new segments can be created via the steps, and/or existing segments can be examined based on events.
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.
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.
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.
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:
| Step | Event Name | Parameter | Flow |
|---|---|---|---|
| 1 | funnel | Step_1 | A,B,C |
| 2 | funnel | Step_1 | A,B,C |
| 3 | funnel | Step_3 | A,B,C |
| 4 | funnel | Step_4 | A,B,C |
| 5 | funnel | Step_5 | C |
| 6 | funnel | Step_6 | A |
| 7 | funnel | Thank You | A,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:
- Maintain the original formatting (markdown, HTML tags, links, etc.)
- Keep technical terms and proper nouns as appropriate
- Preserve code blocks and technical syntax exactly
- Maintain the same tone and style
- 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",
});
//...
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.
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.
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.
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.
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.
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