Skip to main content

Set up Google Analytics 4 and Google BigQuery for Databricks ingestion

Preview

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.

  1. Identify the BigQuery project that contains your exported GA4 data.

  2. 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.

To ingest your GA4 data from the BigQuery project using OAuth, you must grant the authenticating user access to the corresponding BigQuery account.

  1. In the Google Cloud console, navigate to IAM & Admin > IAM.

  2. 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.

  1. In the top menu of the Service Accounts page, click + CREATE SERVICE ACCOUNT.

    Create a GA4 service account

  2. Under Grant this service account access to the project, enable the following roles:

    • BigQuery Data Viewer
    • BigQuery Job User
    • BigQuery Read Session User

    Grant service account access to BigQuery project

  3. Complete service account creation.

  4. On the Service accounts page, click the service account you created.

  5. On the KEYS tab, click ADD KEY > Create new key.

    Create a new key

  6. In the Create private key modal, for Key type, select JSON.

  7. Click CREATE.

    This downloads your service account JSON key.

    Download 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.