Set up Google Analytics 4 and Google BigQuery for Databricks ingestion
The Google Analytics Raw Data connector is in Public Preview.
This page describes how to set up Google Analytics 4 (GA4) and Google BigQuery (BigQuery) to ingest raw, event-level data into Databricks.
Choose an authentication method
The following authentication methods are supported:
- OAuth (recommended)
- Basic authentication with a service account JSON
Databricks recommends OAuth because it’s more secure. However, your organization might choose to use a service account JSON key if, for example, you're migrating from a provider that supports this authentication method.
You'll use the authentication details you obtain during source setup to create a Unity Catalog connection to GA4. Basic authentication is only supported for connections created using Databricks APIs. It's not supported in the Databricks UI.
The permissions requirements are the same for both options, enabling the authenticating user to access the schema and ingest the data.
Enable Google Cloud APIs
Enable the required Google Cloud APIs on the BigQuery project that contains your exported GA4 data.
-
Identify the BigQuery project that contains your exported GA4 data.
-
Enable the following APIs on the project by following the Google documentation:
Grant user permissions
This section enables the authenticating user to access the source schema and ingest the data. The steps to do this depend on your authentication method.
OAuth (recommended)
To ingest your GA4 data from the BigQuery project using OAuth, you must grant the authenticating user access to the corresponding BigQuery account.
-
In the Google Cloud console, navigate to IAM & Admin > IAM.
-
Enable the following roles for the authenticating user:
- BigQuery Data Viewer
- BigQuery Job User
- BigQuery Read Session User
Basic authentication
To ingest your GA4 data from the BigQuery project using basic authentication, you need a corresponding GCP service account.
-
In the top menu of the Service Accounts page, click + CREATE SERVICE ACCOUNT.
-
Under Grant this service account access to the project, enable the following roles:
- BigQuery Data Viewer
- BigQuery Job User
- BigQuery Read Session User
-
Complete service account creation.
-
On the Service accounts page, click the service account you created.
-
On the KEYS tab, click ADD KEY > Create new key.
-
In the Create private key modal, for Key type, select JSON.
-
Click CREATE.
This downloads your service account JSON key.
Export GA4 GA4 data to BigQuery
Identify the GA4 property that you want to ingest from, then export the property's data to BigQuery. For instructions, see Set Up BigQuery Export in the Google documentation.