Exploring GA4 Event Data in BigQuery

Published:

Written by:

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 NameApplicable PlatformDescription
app_updateappWhen a user launches an app for the first time after updating to a new version
clickwebWhen a user clicks on an outbound link
first_openappWhen a user launches an app for the first time after installing or re-installing it
first_visitwebWhen a user visits a website for the first time
form_submitwebWhen a user submits a form on a website
os_updateappWhen the operating system of a device is updated to a new version
page_viewwebWhen a user visits a page on a website
screen_viewappWhen a user views a screen on an app
session_startweb & appWhen a user starts a new session on a website or app
Note: depends on the Session Timeout value set in GA
scrollwebWhen a user scrolls to the bottom of a web page
user_engagementweb & appWhen 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 NameApplicable PlatformDescription
add_to_cartweb & appWhen a user adds an item to the cart
app_openappWhen a user opens an app
begin_checkoutweb & appWhen a user starts to checkout
loginweb & appWhen a user logs in to an app or website
purchaseweb & appWhen a user completes an ecommerce purchase
sign_upweb & appWhen a user registers a new account
searchweb & appWhen a user performs a search
select_itemweb & appWhen a view selects an item/product from a list
select_contentweb & appWhen a user clicks or taps on an element (e.g. button, link, image, etc.)
view_itemweb & appWhen 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.

Next >> 5. Extract GA4 event parameters in BigQuery

New to the GA4 BigQuery export? Check out our free introductory guide.

X