Subscribe to our monthly newsletter to get the latest updates in your inbox
In one of our previous posts, we shared info about an open-source tool from Adswerve that unnests BigQuery (BQ) Google Analytics (GA) 360 data. We developed it for Universal Analytics (UA). Now we’re excited to announce a similar tool for the next generation of GA, Google Analytics 4 (GA4)!
Like UA, GA4 data can be exported into BQ. However, now this feature is free. And While GA4 data in BQ has a simpler structure than UA data, it still contains nested and repeated fields:
GA4 data in BQ has fields that are nested and repeated, or an array of structs. See the example below. It’s from our test GA4 data:
SELECT user_properties FROM
`{project}.analytics_{ga4_property_number}.events_{date_shard}`
WHERE event_timestamp = 1626813980436000
Schema with nested and repeated data can make it harder to query the data (it takes a learning curve to get used to it, even if you are already experienced in SQL). And it may be incompatible with other data systems. For example, you can’t import data into a spreadsheet.
Our GA4 Flattener solves the above problems by flattening/unnesting GA4 data or converting all nested and repeated fields to regular fields (i.e., not a struct or an array, but a string or a number etc.). As a result of flattening, your GA4 data becomes familiar to analyze by using relational join queries. For flat data, imagine a spreadsheet table.
Below is the same data as in the previous example, but this time the data has been flattened:
SELECT * FROM `{project}.analytics_{ga4_property_number}.flat_user_properties_{date_shard}`
WHERE event_id like "%1626813980436000"
GA4 Flattener keeps your original GA4 data with nested and repeated fields, but it also writes four flat tables into the same BQ dataset.
We hope that our GA4 flattener tool will help you analyze GA4 data in BQ and extract actionable insights from it. You can find the repository, description and installation instructions on github.com, specifically at https://github.com/adswerve/google_analytics_flattener_ga4. We encourage all to join the open-source community and install this product.
Please don’t hesitate to reach out with any questions.