Skip to content

Commit

Permalink
Edited the GA4 doc (airbytehq#23911)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amruta-Ranade authored Mar 14, 2023
1 parent dd7da58 commit 8c6bfff
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 53 deletions.
74 changes: 31 additions & 43 deletions docs/integrations/sources/google-analytics-data-api.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
# Google Analytics 4 (GA4)

This page guides you through the process of setting up the Google Analytics source connector.
This page guides you through the process of setting up the Google Analytics 4 source connector.

This connector supports GA4 properties through the [Analytics Data API v1](https://developers.google.com/analytics/devguides/reporting/data/v1).

## Prerequisites

* JSON credentials for the service account that has access to Google Analytics. For more details check [instructions](https://support.google.com/analytics/answer/1009702)
* OAuth 2.0 credentials for the service account that has access to Google Analytics
* Property ID
* Start Date
* Custom Reports (Optional)
* Data request time increment in days (Optional)
A Google Cloud account with [Viewer permissions](https://support.google.com/analytics/answer/2884495) and [Google Analytics Reporting API](https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview) and [Google Analytics API](https://console.developers.google.com/apis/api/analytics.googleapis.com/overview) enabled.

## Step 1: Set up Source
## Setup guide

### Create a Service Account

First, you need to select existing or create a new project in the Google Developers Console:

1. Sign in to the Google Account you are using for Google Analytics as an admin.
2. Go to the [Service Accounts](https://console.developers.google.com/iam-admin/serviceaccounts) 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 \(see below\).

### Add service account to the Google Analytics account

Use the service account email address to [add a user](https://support.google.com/analytics/answer/1009702) to the Google analytics view you want to access via the API. You will need to grant [Viewer permissions](https://support.google.com/analytics/answer/2884495).

### Enable the APIs

1. Go to the [Google Analytics Reporting API dashboard](https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview) in the project for your service user. Enable the API for your account. You can set quotas and check usage.
2. Go to the [Google Analytics API dashboard](https://console.developers.google.com/apis/api/analytics.googleapis.com/overview) in the project for your service user. Enable the API for your account.

### Property ID

To determine a Google Analytics 4 [Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id#what_is_my_property_id)
<!-- env:cloud -->
**For Airbyte Cloud:**

### Step 2: Set up the Google Analytics connector in Airbyte

**For Airbyte Cloud:**
To set up Google Analytics 4 as a source in Airbyte Cloud:

1. [Login to your Airbyte Cloud](https://cloud.airbyte.com/workspaces) account.
1. [Log into your Airbyte Cloud](https://cloud.airbyte.io/workspaces) account.
2. In the left navigation bar, click **Sources**. In the top-right corner, click **+ new source**.
3. On the source setup page, select **Google Analytics 4 (GA4)** from the Source type dropdown and enter a name for this connector.
4. Click `Authenticate your account` by selecting Oauth or Service Account for Authentication.
5. Log in and Authorize the Google Analytics account.
6. Enter the **Property ID** whose events are tracked.
4. Authenticate your Google account via OAuth or Service Account Key Authentication.
- (Recommended) To authenticate your Google account via OAuth, click **Sign in with Google** and complete the authentication workflow.
- To authenticate your Google account via Service Account Key Authentication, enter your [Google Cloud service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys) in JSON format. Use the service account email address to [add a user](https://support.google.com/analytics/answer/1009702) to the Google analytics view you want to access via the API and grant the [Viewer](https://support.google.com/analytics/answer/2884495) permission.
6. Enter the [**Property ID**](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id#what_is_my_property_id).
7. Enter the **Start Date** from which to replicate report data in the format YYYY-MM-DD.
8. Enter the **Custom Reports (Optional)** a JSON array describing the custom reports you want to sync from Google Analytics.
9. 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.
8. Optionally, to generate **Custom Reports**, enter a JSON array describing the [custom reports](#custom-reports) you want to sync from Google Analytics.
9. Leave **Data request time increment in days (Optional)** blank or set to 1. For faster syncs, set this value to more than 1 but that might result in inaccuracies in the returned results. The maximum allowed value is 364.
<!-- /env:cloud -->

<!-- env:oss -->
**For Airbyte Open Source:**

To set up Google Analytics 4 as a source in Airbyte Open Source:

1. Go to the Airbyte UI, click **Sources**, and then click **+ New source**.
2. On the Set up the source page, select **Google Analytics 4 (GA4)** from the **Source type** dropdown.
3. Enter a name for the Google Analytics 4 connector.
4. Authenticate your Google account via OAuth or Service Account Key Authentication:
- To authenticate your Google account via OAuth, enter your Google application's [client ID, client secret, and refresh token](https://developers.google.com/identity/protocols/oauth2).
- To authenticate your Google account via Service Account Key Authentication, enter your [Google Cloud service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys) in JSON format. Use the service account email address to [add a user](https://support.google.com/analytics/answer/1009702) to the Google analytics view you want to access via the API and grant the [Viewer](https://support.google.com/analytics/answer/2884495) permission.
5. Enter the [**Property ID**](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id#what_is_my_property_id).
6. Enter the **Start Date** from which to replicate report data in the format YYYY-MM-DD.
7. Optionally, to generate **Custom Reports**, enter a JSON array describing the [custom reports](#custom-reports) you want to sync from Google Analytics.
8. Leave **Data request time increment in days (Optional)** blank or set to 1. For faster syncs, set this value to more than 1 but that might result in inaccuracies in the returned results. The maximum allowed value is 364.
<!-- /env:oss -->

## Supported sync modes

Expand All @@ -75,7 +69,6 @@ This connector outputs the following incremental streams:

## Custom reports

* Support for multiple custom reports
* Custom reports in format `[{"name": "<report-name>", "dimensions": ["<dimension-name>", ...], "metrics": ["<metric-name>", ...]}]`
* Custom report format when using segments and / or filters `[{"name": "<report-name>", "dimensions": ["<dimension-name>", ...], "metrics": ["<metric-name>", ...], "segments": ["<segment-id-or-dynamic-segment-v3-format]", filter: "<filter-definition-v3-format>"}]`
* When using segments, make sure you add the `ga:segment` dimension.
Expand All @@ -87,11 +80,6 @@ This connector outputs the following incremental streams:

* Number of requests per day per project: 50,000

# Reports

The reports are custom by setting the dimensions and metrics required. To support Incremental sync, the `date` dimension is
added by default to all reports. There are 8 default reports. To add more reports, you need to specify the `custom reports` field.

## Changelog

| Version | Date | Pull Request | Subject |
Expand Down
23 changes: 13 additions & 10 deletions docs/integrations/sources/google-analytics-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This page contains the setup guide and reference information for the Google Anal

This connector supports Universal Analytics properties through the [Reporting API v4](https://developers.google.com/analytics/devguides/reporting/core/v4).

## Prerequisites

A Google Cloud account with [Viewer permissions](https://support.google.com/analytics/answer/2884495) and [Google Analytics Reporting API](https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview) and [Google Analytics API](https://console.developers.google.com/apis/api/analytics.googleapis.com/overview) enabled.

## Setup guide

<!-- env:cloud -->
Expand All @@ -17,7 +21,7 @@ To set up Google Analytics as a source in Airbyte Cloud:
4. For Name, enter a name for the Google Analytics connector.
5. Authenticate your Google account via OAuth or Service Account Key Authentication.
- **(Recommended)** To authenticate your Google account via OAuth, click **Sign in with Google** and complete the authentication workflow.
- To authenticate your Google account via Service Account Key Authentication, enter your [Google Cloud service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys) in JSON format. <!---Make sure the Service Account has the Project Viewer permission. --->
- To authenticate your Google account via Service Account Key Authentication, enter your [Google Cloud service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys) in JSON format. Make sure the Service Account has the Project Viewer permission.
6. Enter the **Replication Start Date** in YYYY-MM-DD format. The data added on and after this date will be replicated. If this field is blank, Airbyte will replicate all data.
7. Enter the [**View ID**](https://ga-dev-tools.appspot.com/account-explorer/) for the Google Analytics View you want to fetch data from.
8. Leave **Data request time increment in days (Optional)** blank or set to 1. For faster syncs, set this value to more than 1 but that might result in the Google Analytics API returning [sampled data](#sampled-data-in-reports), potentially causing inaccuracies in the returned results. The maximum allowed value is 364.
Expand All @@ -28,17 +32,16 @@ To set up Google Analytics as a source in Airbyte Cloud:

To set up Google Analytics as a source in Airbyte Open Source:

1. Go to the [Google Analytics Reporting API dashboard](https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview) in the project for your service user and enable the Reporting API for your account. Then go to the [Google Analytics API dashboard](https://console.developers.google.com/apis/api/analytics.googleapis.com/overview) in the project for your service user and enable the API for your account.
2. Go to the Airbyte UI and click **Sources** and then click **+ New source**.
3. On the Set up the source page, select **Google Analytics** from the **Source type** dropdown.
4. Enter a name for the Google Analytics connector.
5. Authenticate your Google account via OAuth or Service Account Key Authentication:
1. Go to the Airbyte UI and click **Sources** and then click **+ New source**.
2. On the Set up the source page, select **Google Analytics** from the **Source type** dropdown.
3. Enter a name for the Google Analytics connector.
4. Authenticate your Google account via OAuth or Service Account Key Authentication:
- To authenticate your Google account via OAuth, enter your Google application's [client ID, client secret, and refresh token](https://developers.google.com/identity/protocols/oauth2).
- To authenticate your Google account via Service Account Key Authentication, enter your [Google Cloud service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys) in JSON format. Use the service account email address to [add a user](https://support.google.com/analytics/answer/1009702) to the Google analytics view you want to access via the API and grant [Read and Analyze permissions](https://support.google.com/analytics/answer/2884495).
6. Enter the **Replication Start Date** in YYYY-MM-DD format. The data added on and after this date will be replicated. If this field is blank, Airbyte will replicate all data.
7. Enter the [**View ID**](https://ga-dev-tools.appspot.com/account-explorer/) for the Google Analytics View you want to fetch data from.
8. Optionally, enter a JSON object as a string in the **Custom Reports** field. For details, refer to [Requesting custom reports](#requesting-custom-reports)
9. Leave **Data request time increment in days (Optional)** blank or set to 1. For faster syncs, set this value to more than 1 but that might result in the Google Analytics API returning [sampled data](#sampled-data-in-reports), potentially causing inaccuracies in the returned results. The maximum allowed value is 364.
5. Enter the **Replication Start Date** in YYYY-MM-DD format. The data added on and after this date will be replicated. If this field is blank, Airbyte will replicate all data.
6. Enter the [**View ID**](https://ga-dev-tools.appspot.com/account-explorer/) for the Google Analytics View you want to fetch data from.
7. Optionally, enter a JSON object as a string in the **Custom Reports** field. For details, refer to [Requesting custom reports](#requesting-custom-reports)
8. Leave **Data request time increment in days (Optional)** blank or set to 1. For faster syncs, set this value to more than 1 but that might result in the Google Analytics API returning [sampled data](#sampled-data-in-reports), potentially causing inaccuracies in the returned results. The maximum allowed value is 364.
<!-- /env:oss -->

## Supported sync modes
Expand Down

0 comments on commit 8c6bfff

Please sign in to comment.