Google Analytics 4

Google Analytics 4 (GA4)

Overview

This page contains the setup guide and reference information for the Google Analytics 4 source connector.

Google Analytics 4 (GA4) connector is the latest version of Google Analytics, which was introduced in 2020. It offers a new data model that emphasizes events and user properties, rather than pageviews and sessions. This new model allows for more flexible and customizable reporting, as well as more accurate measurement of user behavior across devices and platforms.

Features

Feature NameSupported
Full ImportYes
Incremental ImportYes
Start Date SelectionYes
Custom reportsYes

Custom reports

  • Custom reports should be provided in format [{"name": "<report-name>", "dimensions": ["<dimension-name>", ...], "metrics": ["<metric-name>", ...], "cohortSpec": "<cohortSpec>", "pivots": "<pivots>"}]. Both pivots and cohortSpec are optional. Detailed description of the cohortSpec and the pivots objects can be found here (opens in a new tab) and here (opens in a new tab).
  • To enable Incremental sync for Custom reports, you need to include the date dimension (except for the custom Cohort reports).

Supported streams

Getting started

Requirements and prerequisites

  1. The Property ID (opens in a new tab) you are willing to sync.
  2. One of the following two types of credentials:
    • JSON credentials for the service account that has access to Google Analytics. For more details check instructions (opens in a new tab).
    • OAuth 2.0 credentials that have access to Google Analytics
  3. Enable the APIs:

(Optional) Create a new Google service account, if you do not have one:

  1. Sign in to the Google Account you are using for Google Analytics as an admin.
  2. Go to the Service Accounts (opens in a new tab) page.
  3. Click Create service account.
  4. Create a JSON key file for the service user. The contents of this file will be provided as the credentials_json in the UI when authorizing GA after you grant permissions.
  5. Use the service account email address to add a user (opens in a new tab) to the Google analytics view you want to access via the API. You will need to grant Viewer permissions (opens in a new tab)

Set up guide

  1. Create a new source, select Google Analytics 4 (GA4) from the Source type dropdown and enter a name for it.
  2. On the source setup page, create a new Google Analytics 4 secret, enter a unique name for it.
  3. Enter the Property ID (opens in a new tab) whose events are tracked.
  4. Enter the Start Date from which to replicate report data. (Not applied to custom Cohort reports).
  5. Enter the Custom Reports (Optional) a JSON array describing the custom reports you want to sync from Google Analytics.
  6. Enter the Data request time increment in days (Optional). The bigger this value is, the faster the sync will be, but the more likely that sampling will be applied to your data, potentially causing inaccuracies in the returned results. We recommend setting this to 1 unless you have a hard requirement to make the sync faster at the expense of accuracy. The minimum allowed value for this field is 1, and the maximum is 364. (Not applied to custom Cohort reports).
  7. Authenticate your connector via OAuth or Service Account Key Authentication:
    • To authenticate your Google account via OAuth, pick Authenticate via Google (OAuth) option and click Authorize with Google Analytics 4
    • To authenticate via Service Account Key Authentication, pick Service Account Key Authentication option, and paste your Google Cloud service account key (opens in a new tab) in JSON format.

Performance considerations

Google Analytics Data API Quotas docs (opens in a new tab).