When you link a GA4 property with a BigQuery project and more than 24 hrs have elapsed, you should see a new dataset named “analytics_<property_id>” automatically added to the linked BigQuery project:
Here the ‘Property ID’ refers to your GA4 Property ID, which you can find in the property settings for your GA4 property:
The dataset named “analytics_<property_id>” contains the following two data tables which store the imported GA4 data in the linked BigQuery project:
#1 events_(<number of days>) – This data table stores all the GA4 event data from the previous day(s).
This table is automatically updated for each day of export.
Note(1): The ‘events_intraday_’ data table is automatically deleted at the end of each day once the ‘events_’ data table is complete.
Note(2): The ‘events_intraday_’ data table is not available to you in your BigQuery project, if you are using BigQuery Sandbox.
Rows and Columns of the GA4 Data Tables in BigQuery
Each data table in your BigQuery project is made up of rows and columns:
Each row in the data table corresponds to a single event.
For example, in the screenshot above, the first row corresponds to the ‘first_visit’ event.
Similarly, the second row corresponds to the ‘session_start’ event.
Each column (field) in the data table corresponds to an event parameter of GA4 events.
For example, in the screenshot above, the first column corresponds to the ‘event_date’ parameter of the ‘first_visit’ event and the ‘session_start’ event.
Similarly, the second column corresponds to the ‘event_timestamp’ parameter of the ‘first_visit’ event and the ‘session_start’ event.
All the event parameters listed for each GA4 event carry a special meaning.
For example,
‘event_date’ denotes the date on which the GA4 event was logged.
‘event_timestamp’ denotes the time (in microseconds, UTC) at which the event was logged.
When you send data from a GA4 property to BigQuery, you use the default schema (i.e. structure) provided by Google.
As a result, Google automatically created a set of tables (‘events_‘ and ‘events_intraday_‘) in the pre-built dataset (“analytics_<property_id>“).
You do not get the option of creating the data tables you want or setting the fields you want to see in the data table(s):
When you use the default schema you have no control over the fields (columns) that appear in your data tables and no control over the number and type of data tables you see in your dataset.
If you want to see your data tables with only the fields you want then you need to first create your own schema (also called Custom Schema).
The custom schema that you create depends on the data source being used.
For example, if you are using GA4 as a data source then you define a schema by selecting the dimensions and metrics you want to see in your data table.
Then you add one or more queries to it.
The GA4 data that you send to BigQuery via custom schema is called the custom GA4 data.
How to send custom GA4 data to BigQuery
Following is the 10,000 foot view of sending custom GA4 data to BigQuery:
#1 You would first need to create a BigQuery project and the corresponding dataset where you are going to store GA4 data in BigQuery.
You can also use an existing project and/or dataset if you want.
Note: Instead of creating a new project, we are going to use the ‘GA4 BigQuery’ project we created earlier:
We would use the existing dataset named ‘analytics_298851313’ for storing custom data from GA4 into BigQuery:
#2 Figure out the overall layout and format (wireframe) of how your data table should look in the BigQuery.
#3 Based on your wireframe, create a custom schema and query via a third-party solution (connector).
#4 Create, configure and save your data transfer in BigQuery.
We create data transfer in order to automatically send custom GA4 data to our BigQuery project on a regular basis.
#5 Backfill GA4 data in BigQuery.
#6 Query the GA4 data you need in BigQuery.
How to create a wireframe of your GA4 data table in BigQuery
Before you create a custom schema, you would need to first figure out the overall layout and format of how your data table should look like in the BigQuery.
It’s like creating a wireframe before you actually start designing a website.
You can create this wireframe either in your head or on a piece of paper.
You can also use an existing Google Analytics report as a wireframe.
Let’s extract GA4 data in the following format in BigQuery:
Here the screenshot of the GA4 exploration report acts as a wireframe for us.
From the GA4 screenshot above we can determine the following things about, how our data table should look in BigQuery:
Our data table should have one primary dimension called ‘Country’.
Our data table should have the following four metrics: ‘Total Users‘, ‘New Users‘, ‘Sessions‘ and ‘Engaged Sessions‘
The data table needs to have 10 rows.
The data in the data table should be sorted by ‘sessions’ in descending order.
The data in the data table should be from the last 30 days (not shown in the GA4 screenshot above).
Step-12: Type a name for your custom schema (say ‘GA4 Custom Schema’ and then click on the ‘OK’ button:
You should now see your schema listed:
Note: If you click on the ‘STANDARD‘ button you can see the list of all pre-built queries used by the STANDARD schema:
The lock sign next to ‘STANDARD’ indicates that the standard schema is locked for editing i.e. you can not edit this schema.
Each schema query corresponds to one data table in your BigQuery project.
So when you create a GA4 data transfer in BigQuery, you will see a separate data table in your BigQuery project for each schema query listed in your Supermetrics Query manager:
Step-13: Click on the ‘QUERY‘ tab:
You should now see a screen like the one below:
Step-14: Click on the ‘Select Properties‘ button:
Step-15: Click on the ‘Select…‘ to open a drop-down menu:
Step-16: Click on the GA4 property you want to extract the custom data from:
Step-17: Click on the ‘Select dates‘ button to set the date range for your data table in BigQuery:
Step-18: Set your date range:
Step-19: Click on the ‘Select Metrics‘ button:
Step-20: Click on the ‘Select…‘ to open a drop-down menu:
Step-21: Select the metrics you want to add to your data table in BigQuery:
For this exercise, I would add the following four metrics one by one: ‘Total Users‘, ‘New Users‘, ‘Sessions‘ and ‘Engaged Sessions‘
Step-22: Click on the ‘Split by‘ button:
Step-23: Click on the ‘Select…‘ to open a drop-down menu:
Step-24: Select ‘Country’ and ‘Date‘ dimensions to splits rows (of the data table in BigQuery) by country and date:
Note: Make sure that you always select the “Date” dimension. Otherwise, you will not be able to query data for a particular date in BigQuery.
Step-25: Set the number of rows to fetch to ’10’ from the drop-down menu:
Step-26: Set the ‘Sort rows‘ setting to ‘Sessions‘ and ‘Sort Direction‘ setting to ‘Descending‘:
Step-27: Click on the ‘Options‘ button:
Step-28: Select ‘Show all time values’
When you are splitting the data by date dimension, using this setting ensures all time values (dates, weeks, months, years) will be returned even if there is no data for some of them.
Step-29: Validate your query by clicking on the ‘Run‘ button:
You should now see a screen like the one below with status 200 OK and the preview of the data table:
Step-30: Click on the ‘SAVE AS‘ button to save this query in your custom schema:
Step-31: Give your query a name (say ‘Top Countries by Sessions’):
Step-32: Select your custom schema from the drop-down menu and then click on the ‘OK‘ button:
Congratulations.
You have now successfully created your custom schema:
Note: Each query in your custom schema corresponds to one data table in your BigQuery project.
Let us suppose, you are using a custom schema while creating a data transfer.
Now if you create multiple queries in your custom schema (which is possible) then multiple data tables would automatically be created in your BigQuery project.
Step-2: Make sure that you are in the right project:
Step-3: Click on the link ‘Data transfers‘ from the left-hand side navigation:
Step-4: Click on the ‘Enable‘ button to enable the ‘BigQuery Data Transfer API’:
Step-5: Click on the link ‘+CREATE TRANSFER‘:
Step-6: Click on the ‘Enable API‘ button:
Step-7: Click on the drop-down menu to choose a data source:
Step-8: Click on the ‘EXPLORE DATA SOURCES‘ button:
Step-9: Type ‘supermetrics google analytics 4‘ in the search box and then press the enter key:
Step-10: Click on the search result ‘Google Analytics 4 by Supermetrics‘:
Step-11: Click on the ‘ENROL‘ button:
Step-12: Click on ‘Google Analytics 4 by Supermetrics‘:
Step-13: Type a meaningful name for the ‘Transfer config name‘ field:
Step-14: Keep the ‘Repeats‘ setting to ‘Daily‘ to have new data added once a day and move on to the next step:
Step-15: Keep the scheduling options (which specify when the transfer will run) to ‘Start now’ (unless you want to change it) and then move on to the next step:
Note: The ‘Start date and run time‘ setting is locked for editing when the ‘Start now‘ setting is selected.
Step-16: Scroll down until you see a screen like the one below:
Step-17: Click on the ‘Data set‘ field:
Step-18: Select your data set from the drop-down menu:
We are going to use this data set for storing Custom GA4 data in BigQuery.
Step-19: Click on the ‘CONNECT SOURCE’ button:
Step-20: Click on the ‘Accept Agreement‘ button:
Step-21: Click on the ‘Continue‘ button:
Step-22: Click on the ‘Schema‘ drop-down menu:
Step-23: Select the custom schema you created earlier from the drop-down menu:
Note: If you do not see the schema drop-down menu then cancel the data transfer and try again after 24 hrs.
Step-24: Click on the ‘Submit‘ button:
You should now see the ‘source connected‘ message just below ‘Third party connection‘:
Step-25: Click on the ‘SAVE‘ button to save the transfer and also start the initial data transfer:
You should now see a screen like the one below:
Note: If after following the instructions your data transfer is still not created then refresh the browser window and then recreate the data transfer.
Step-3: Click on the data table corresponding to the custom query we created earlier to see what data it contains
If you remember, we created the ‘Top Countries by sessions’ query using the ‘GA4 Custom Schema’ via the Supermetrics Query Manager:
The BigQuery data table corresponding to the ‘Top Countries by sessions’ query is GAWA_TOP_COUNTRIES_BY_SESSIONS_20220809
Note: Since our custom schema contains only one query, therefore only one data table is automatically created and added. Had our custom schema got multiple queries (say four queries) then four data tables would have been automatically created and added.
Step-4: Click on the ‘Preview‘ tab to preview the data table:
At this point, you can query a particular set of data by clicking on the ‘Query’ button:
That’s how you can send custom GA4 data to BigQuery.
Other articles related to GA4 (Google Analytics 4)
"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."
Here’s what we’re going to cover in this training…
#1 Why digital analytics is the key to online business success.
#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.
#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.
#4 Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.
#5 The number 1 reason why conversion optimization is not working for your business.
#6 How to advertise on any marketing platform for FREE with an unlimited budget.
#7 How to learn and master digital analytics and conversion optimization in record time.
My best selling books on Digital Analytics and Conversion Optimization
Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.
Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.
Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.
Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.
About the Author
Himanshu Sharma
Founder, OptimizeSmart.com
Over 15 years of experience in digital analytics and marketing
Author of four best-selling books on digital analytics and conversion optimization
Nominated for Digital Analytics Association Awards for Excellence
Runs one of the most popular blogs in the world on digital analytics
Consultant to countless small and big businesses over the decade
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.