Google Analytics 4 Boilerplate
Only in Essential Plan and above
Get started with your Google Analytics (GA4) data in Wren AI by using our boilerplate. This template provides a structured framework for importing and analyzing your Google Analytics data, saving you time and effort.
Prerequisites
- GCP Account
- GCP Project Id
- GCP Dataset with Google Analytics data
- GCP rights to provide principal permissions
- Google Analytics Account
Importing Google Analytics Data into GCP
Your GCP account must have the Editor or Administrator roles. You may also insure in additional billing costs in GCP for BigQuery compute and storage pricing. It is recommended to have some level of experience with GCP for this section.
Prerequisites
- GCP Project Editor or Administrator roles
- Google Analytics Account Editor or Administrator roles for the properties & apps
You can also refer to Google’s Official documentation on how to export Google Analytics Data to GCP.
GCP Developer Console
In your Google Cloud Console, create a new project or select an existing project to use for your Google Analytics Data. Within this selected project, go to the API &Services section, then choose Library. Next, you will need to activate the BigQuery service for this project. In the Google Cloud APIs, click BigQuery and enable it.
Wren AI Cloud supports if your project is using BigQuery Sandbox.
Google Analytics Console
In your Google Analytics Project, go to the Admin Section, find the Product link tab, and select BigQuery Links. Click the Link button and choose the BigQuery Project previously created.
You can select which data streams to include in BigQuery by going to Data streams and events. You have the flexibility to exclude certain events from being synced to Bigquery to filter anything which is not useful or may be sensitive data. To exclude this you must use see on the predefined list of existing events to exclude and you can specify event by name in the Exclude Events section by adding them.
Steps to use Google Analytics Boilerplate
Before continuing, please make sure you've successfully imported your data into GCP.
Click the Google Analytics option in the Start with a Data Boilerplate section to add a Google Analytics Boilerplate.
Ensure you have imported your Google Analytics data into Bigquery for this step. It is recommended that you do this step in a separate browser tab.
You will be asked to provide Bigquery Data Viewer permissions to the Wren AI service account. To do this, you must go into your GCP project, select the three dots on the resource containing your imported Google Analytics data, and select manage permissions.
Select the Add Principal button to grant new access. Paste the Wren AI Service Account Principal Address generated on your Wren AI Cloud Project page. In the assign roles section, please select BigQuery Data Viewer and save.
The Viewer Role permission is read-only access to Bigquery data and metadata. This allows Wren AI Cloud to see your tables and explore schema to generate the queries in Wren AI Cloud Console. We can will not modify or delete any of your GCP resources.
Once the Wren AI Service account has been added to your GCP project, please input your project ID. This can be found on the GCP Developer Console; click on the GCP project, and at the top, it will tell you the project ID.
Next, add your dataset ID. Access the BigQuery dataset ID in the GCP Developer Console and inside the desired project. In the resources section, find the dataset, click on the 3 dots next to the dataset name, and select copy ID.
When done, click continue.
Review Pre-filled Fields
The project modeling page displays all fields and their sub-values from the Google Analytics Boilerplate. These fields include events, orders, pages, traffic sources, and device browsing information. We've added a visual marker to indicate the boilerplate's origin, making it easier to differentiate between views and models.
Learn more about views
Ask Questions
To start your analysis, ask questions about your synced Google Analytics data. We offer a range of pre-defined questions to help you explore engagement, acquisition, and monetization.
What does user_pseudo_id
mean in the boilerplate?
user_pseudo_id in GA4 is a unique identifier that Google assigns to a user to track their interactions across different devices and platforms. It's designed to provide a more comprehensive view of user behavior without revealing personally identifiable information (PII).
You can customize the user_pseudo_id using your own implementation to align with your specific tracking needs.