This is the second part of a series on learning SQL by performing simple analysis on the GA4 export data published by Google. We will look at specific SQL syntax. This time, we will extract data by executing a SELECT statement.
Click here for the previous article (overview) →
>>Download the document set (service documents and case studies) to learn about Ollie's
Table of Contents [ Hide ]
Introduction: What is GA4's "BigQuery phone number list india Export" feature?
Access sample data
Open BigQuery
Run the query: Query No.1
Execute a SELECT statement
Executing a SELECT statement (getting all columns): Query No.2
Executing a SELECT statement (retrieving columns): Query No.3
[Side note] What does the "*" in the FROM clause mean?
"Clause" to be combined with SELECT statement
summary
Introduction: What is GA4's "BigQuery Export" feature?
BigQuery is a cloud-based data warehouse provided by GCP (Google Cloud Platform), meaning it is a place to store data.
Although it has been around for some time, GA4 (Google Analytics 4) now makes it easy to export data to BigQuery (BigQuery Export).
This made it possible to analyze user behavior data on a granular level, giving those who could write SQL the opportunity to access "more fundamental data."
First, let's check the data output by the BigQuery Export function using the sample dataset provided by Google.
All you need is a GCP account.
Access sample data
developers.google.com
BigQuery Sample Dataset for Google Analytics 4 Ecommerce Web Implementation
Google Merchandise Store is an online store that sells Google-branded merchandise. The site uses the standard web ecommerce implementation and advanced measurement features of Google Analytics 4...
Open BigQuery
First, to open BigQuery from GCP, open BigQuery from the search box at the top.
When you open BigQuery, it is divided into three sections as shown below.
Pane 1: Services within BigQuery. Since we will only be using the SQL workspace this time, you can close it by pressing the <| mark at the bottom.
Pane 2: You can select a dataset. Since we will be using sample data this time, we will not use this either. You can close it by pressing the |< mark at the top.
Pane 3: This is the pane where you write and execute queries.
Run the query: Query No.1
Let's run the query listed on Google Developers.
SELECT
COUNT(*) AS event_count,
COUNT(DISTINCT user_pseudo_id) AS user_count,
COUNT(DISTINCT event_date) AS day_count
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
Copy the query into the query description section in ③ and click the execute button just above.
SQL allows you to extract data by executing queries like this.
In this sample query, we aggregate and retrieve the number of rows of data, the number of users, and the number of days included in the data.