bigfunctions > create_ga4_views
create_ga4_views¶
Call or Deploy create_ga4_views
?
✅ You can call this create_ga4_views
bigfunction directly from your Google Cloud Project (no install required).
- This
create_ga4_views
function is deployed inbigfunctions
GCP project in 39 datasets for all of the 39 BigQuery regions. You need to use the dataset in the same region as your datasets (otherwise you may have a function not found error). - Function is public, so it can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- You may prefer to deploy the BigFunction in your own project if you want to build and manage your own catalog of functions. This is particularly useful if you want to create private functions (for example calling your internal APIs). Discover the framework
Public BigFunctions Datasets:
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Description¶
Signature
create_ga4_views(ga4_dataset, destination_dataset)
Description
Create views to help querying GA4 Data .
This function creates table functions in destination_dataset
to help querying GA4 data contained in ga4_dataset
(like your-project.analytics_123456789
).
Table functions are like views but take parameters as input. Here, they take
start_date
andend_date
parameters to restrict the analysis period and be more efficient
Each created table function is the copy of a query from Bigquery-GA4-Queries GitHub repo created by Ali Izadi.
For example, event_scope__flatten_events
table function will be created in destination_dataset
.
You can then get the flatten events between '2024-11-01' and '2024-12-01' with:
select *
from `destination_dataset`.event_scope__flatten_events('2024-11-01', '2024-12-01')
You can get details on each created table function by reading the README of Bigquery-GA4-Queries repo. If you find these queries useful, please add a star to the repo to show your support.
Queries from
BigQuery Administration
,Extras
folders are ignored as they go beyond GA4
Examples¶
call bigfunctions.eu.create_ga4_views('your-project.your_ga4_dataset', 'your-project.your_destination_dataset');
call bigfunctions.us.create_ga4_views('your-project.your_ga4_dataset', 'your-project.your_destination_dataset');
call bigfunctions.europe_west1.create_ga4_views('your-project.your_ga4_dataset', 'your-project.your_destination_dataset');
Need help using create_ga4_views
?
The community can help! Engage the conversation on Slack
For professional suppport, don't hesitate to chat with us.
Found a bug using create_ga4_views
?
If the function does not work as expected, please
- report a bug so that it can be improved.
- or open the discussion with the community on Slack.
For professional suppport, don't hesitate to chat with us.
Use cases¶
Steps to Query GA4 Data Efficiently Using BigFunctions¶
1. Create a Destination Dataset
Prepare a dataset in BigQuery where the GA4 table functions will be stored. For example:
create schema `Ga4-Project.ga4_bigquery_queries`;
2. Call the GA4 View Creation Function
Use the bigfunction to create table functions for querying GA4 data. For example:
call bigfunctions.us.create_ga4_views(
'Ga4-Project.analytics_310989290',
'Ga4-Project.ga4_bigquery_queries'
);
3. Wait for the function to process and create all necessary table functions.
Once completed, all table functions (queries) are available in your destination dataset.
4. Query GA4 Data Using Table Functions
You can now query specific GA4 data efficiently with date ranges by calling the created table functions. For example:
select *
from `Ga4-Project.ga4_bigquery_queries`.event_scope__flatten_events('2024-11-01', '2024-12-01');
Replace '2024-11-01' and '2024-12-01' with your desired date range.
Spread the word¶
BigFunctions is fully open-source. Help make it a success by spreading the word!