This tutorial marks the beginning of your journey into exploring and extracting specific information from your GA4 data. We’ll delve into event data, understand the types of events you might encounter, and perform queries to gain insights into user interactions. Whether you’re analysing web or app data, this tutorial will provide all the detail you need to start exploring event data.
This is part 4 of 10 in our series, “Get Started with the GA4 BigQuery Export”. Check out the course overview for a full list of all the topics covered.
Introduction
In the previous tutorials, we’ve laid the foundations for your GA4 BigQuery export journey, from setting up the export to accessing sample datasets and understanding the data structure. Now that you’re well-equipped with this knowledge, it’s time to dive headfirst into the wealth of data at your fingertips.
Within the events_ export tables, each row encapsulates a valuable event tracked by your GA property. These events can vary based on your specific Google Analytics implementation, but you can expect to encounter some common ones. In the upcoming sections, we’ll unravel these events, exploring their significance and how to harness them for insightful analysis.
Automatically collected events
Automatically collected events are those that GA4 can gather without the need for any custom implementation. You’re likely to encounter some or all of these in the BigQuery data (depending on whether you have web or app data streams enabled).
Please note that for websites, the availability of automatically collected events depends on GA4’s enhanced measurement settings, while for apps, they are triggered by the Firebase SDK.
Event Name | Applicable Platform | Description |
---|---|---|
app_update | app | When a user launches an app for the first time after updating to a new version |
click | web | When a user clicks on an outbound link |
first_open | app | When a user launches an app for the first time after installing or re-installing it |
first_visit | web | When a user visits a website for the first time |
form_submit | web | When a user submits a form on a website |
os_update | app | When the operating system of a device is updated to a new version |
page_view | web | When a user visits a page on a website |
screen_view | app | When a user views a screen on an app |
session_start | web & app | When a user starts a new session on a website or app Note: depends on the Session Timeout value set in GA |
scroll | web | When a user scrolls to the bottom of a web page |
user_engagement | web & app | When an app is in the foreground, or webpage in focus, for at least one second |
Custom events
Beyond the core events collected automatically, you’ll likely discover additional events within the exported data. These events can fall into two categories: Google’s recommended events and custom events that are unique to your site or app.
Please keep in mind that the list below is not exhaustive, but it provides insight into some common events you might come across in your data.
Event Name | Applicable Platform | Description |
---|---|---|
add_to_cart | web & app | When a user adds an item to the cart |
app_open | app | When a user opens an app |
begin_checkout | web & app | When a user starts to checkout |
login | web & app | When a user logs in to an app or website |
purchase | web & app | When a user completes an ecommerce purchase |
sign_up | web & app | When a user registers a new account |
search | web & app | When a user performs a search |
select_item | web & app | When a view selects an item/product from a list |
select_content | web & app | When a user clicks or taps on an element (e.g. button, link, image, etc.) |
view_item | web & app | When a user views an item/product |
Querying events
Now, let’s explore some sample queries that make use of the event_name field.
Important Note: In all the queries provided below, make sure to replace the placeholders within the WHERE clause with the specific values for the table you are working with. For example, if you want to extract data for January 31st 2021 from the e-commerce sample dataset, use the following values:
- <project> should be replaced with bigquery-public-data
- <dataset> should be replaced with ga4_obfuscated_sample_ecommerce
- <table> should be replaced with events_20210131
Ensure that you substitute these placeholders with your actual project, dataset, and table names when executing the queries.
List of distinct events
Retrieve a list of unique event names within a table:
SELECT DISTINCT(event_name)
FROM `<project>.<dataset>.<table>`
Count of events by name
Return a count of events collected for each event name:
SELECT
event_name,
COUNT(*) AS event_count
FROM `<project>.<dataset>.<table>`
GROUP BY event_name
ORDER BY 2 DESC
Filter records by event name
To filter the results to a specific event, you can add a WHERE
clause to your query.
This query will return all rows where the event_name matches the specified event (purchase in this case). Adjust the event_name value as needed to filter for different events.
SELECT *
FROM `<project>.<dataset>.<table>`
WHERE event_name = 'purchase'
Filter records by multiple event names
If you want to filter the results to more than one event, you can use the SQL IN
clause in your query.
This query will return all rows where the event_name matches any of the specified events in the list. You can adjust the list of event names as needed to filter for different events.
SELECT *
FROM `<project>.<dataset>.<table>`
WHERE event_name IN ('page_view', 'screen_view')
Wrapping up
In this tutorial, we took a deep dive into querying events within the GA4 BigQuery export. You’ve learned how to retrieve unique event names, count events for each event name, and filter results based on specific events. This knowledge will empower you to analyze and extract valuable insights from your GA4 data.
In the next tutorial, we’ll expand our capabilities further by exploring how to extract event parameters, which can provide even more detailed and customized insights.