- GA4 BigQuery Newsletter For Marketing Analytics
- Posts
- Event Parameters and Other Records in GA4 BigQuery Data
Event Parameters and Other Records in GA4 BigQuery Data
Learn BigQuery with GA4
GA4 captures a wealth of data in event parameter columns, representing custom parameters associated with user interactions on your digital properties.
BigQuery uses a column (or field) of data type “record” to store the record of all the event parameters and their values.
The record type data is nested arrays or structs, making it challenging to analyze them directly.
Note: If you are new to BigQuery and SQL then check out this post first, 5 Short Lessons To Get Started with GA4 BigQuery
Event parameters are not the only ones that are stored in that way, there are other fields in all three GA4 tables in BigQuery, that are stored in a similar format.
By mastering how to deal with event parameters in BigQuery, you empower yourself to unlock the full potential of GA4 event parameter data.
I am sure you are already familiar with event parameters in BigQuery but let us look at it again.
In the screenshot below, you can see that the “page_view” event has several event parameters stored in the “event_params” column. This column contains the record of all the event parameters. This record contains, the “event_params.key” column, which contains the names of all the event parameters, and the values of each paramater are stored in one of the next three columns, based on the data type of the value.
If the value of the parameter is an integer ( a number without decimals and fractions) then the value is stored in the “event_params.value.int_value” column, if the value of the paramater is a string (any character) then the value is stored in the “event_params.value.string_value” column, however, if it is a decimal value then it is stored in the “event_params.value.douable_value” column. There is also an “event_params.value.float_value” column in GA4 BigQuery export, but that is not currently used by GA4/BigQuery.
If you try to write a “SELECT” statement referring to any of the event_params.key values then you will get an error.
So how do you find all the records where page_title is “Learn BigQuery for GA4” or where the source is “m.facebook.com”?
That’s where you need to use a function called UNNEST in GA4.
UNNEST is a BigQuery function that helps flatten these nested structures, allowing for more straightforward analysis and querying.
Step-by-Step Guide to UNNESTing GA4 Event Parameters:
Reply