Skip to content

Latest commit

 

History

History
78 lines (51 loc) · 4.96 KB

google-analytics-v4.md

File metadata and controls

78 lines (51 loc) · 4.96 KB

Google Analytics 4 (GA4)

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

This connector supports GA4 properties through the Analytics Data API v1.

Prerequisites

  • JSON credentials for the service account that has access to Google Analytics. For more details check instructions
  • OAuth 2.0 credentials for the service account that has access to Google Analytics
  • Property ID
  • Date Range Start Date
  • Data request time increment in days (Optional)

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.
  • Custom reports: Dimensions and metrics explorer
  • Custom reports: Segment and filter definition guide (v3 format)
  • Example: [{"name": "sessions_example", "dimensions": ["ga:date", "ga:segment", "ga:deviceCategory"], "metrics": ["ga:pageviews","ga:sessions","ga:users","ga:transactions"], "segments": ["sessions::condition::ga:browser==Chrome"], "filter": "ga:deviceCategory==desktop"}]

Step 1: Set up Source

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 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 to the Google analytics view you want to access via the API. You will need to grant Viewer permissions.

Enable the APIs

  1. Go to the Google Analytics Reporting API dashboard 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 in the project for your service user. Enable the API for your account.

Property ID

Specify the Property ID as set here

Step 2: Set up the source connector in Airbyte

Set the required fields in the Google Analytics Data API connector page such as the JSON credentials, property ID, custom reports, date ranges start date, data request time increment in days.

Supported sync modes

The Google Analytics source connector supports the following sync modes:

  • Full Refresh
  • Incremental

Rate Limits & Performance Considerations (Airbyte Open-Source)

Google Analytics Data API

  • 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 uuid field is added by default to any report. There are 8 default reports. To add more reports, you need to specify the custom reports field.

Changelog

Version Date Pull Request Subject
0.0.4 2022-09-24 16920 Added segments and filters to custom reports
0.0.3 2022-08-15 15229 Source Google Analytics Data Api: code refactoring
0.0.2 2022-07-27 15087 fix documentationUrl
0.0.1 2022-05-09 12701 Introduce Google Analytics Data API source