Google Analytics (Universal Analytics)
This page contains the setup guide and reference information for the Google Analytics (Universal Analytics) source connector.
This connector supports Universal Analytics properties through the Reporting API v4.
The Google Analytics (Universal Analytics) connector will be deprecated soon.
Google is phasing out Universal Analytics in favor of Google Analytics 4 (GA4). In consequence, we are deprecating the Google Analytics (Universal Analytics) connector and recommend that you migrate to the Google Analytics 4 (GA4) connector as soon as possible to ensure your syncs are not affected.
Due to this deprecation, we will not be accepting new contributions for this source.
For more information, see "Universal Analytics is going away".
Google Analytics Universal Analytics (UA) connector, uses the older version of Google Analytics, which has been the standard for tracking website and app user behavior since 2012.
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.
Prerequisites
A Google Cloud account with Viewer permissions and Google Analytics Reporting API and Google Analytics API enabled.
Setup guide
For Airbyte Cloud:
- Log into your Airbyte Cloud account.
- In the left navigation bar, click Sources. In the top-right corner, click + New source.
- On the Set up the source page, select Google Analytics from the Source type dropdown.
- For Name, enter a name for the Google Analytics connector.
- Authenticate your Google account via Service Account Key Authentication.
- To authenticate your Google account via Service Account Key Authentication, enter your Google Cloud service account key in JSON format. Make sure the Service Account has the Project Viewer permission.
- 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.
- Enter the View ID for the Google Analytics View you want to fetch data from.
- 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, potentially causing inaccuracies in the returned results. The maximum allowed value is 364.
For Airbyte Open Source:
- Navigate to the Airbyte Open Source dashboard.
- Go to the Airbyte UI and click Sources and then click + New source.
- On the Set up the source page, select Google Analytics from the Source type dropdown.
- Enter a name for the Google Analytics connector.
- Authenticate your Google account via Service Account Key Authentication:
- To authenticate your Google account via Service Account Key Authentication, enter your Google Cloud service account key in JSON format. Use the service account email address to add a user to the Google analytics view you want to access via the API and grant Read and Analyze permissions.
- 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.
- Enter the View ID for the Google Analytics View you want to fetch data from.
- Optionally, enter a JSON object as a string in the Custom Reports field. For details, refer to Requesting custom reports
- 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, potentially causing inaccuracies in the returned results. The maximum allowed value is 364.
Supported sync modes
The Google Analytics source connector supports the following sync modes:
- Full Refresh - Overwrite
- Full Refresh - Append
- Incremental Sync - Append
- Incremental Sync - Append + Deduped
You need to add the service account email address on the account level, not the property level. Otherwise, an 403 error will be returned.
Supported streams
The Google Analytics (Universal Analytics) source connector can sync the following tables:
Stream name | Schema |
---|---|
website_overview | {"ga_date":"2021-02-11","ga_users":1,"ga_newUsers":0,"ga_sessions":9,"ga_sessionsPerUser":9.0,"ga_avgSessionDuration":28.77777777777778,"ga_pageviews":63,"ga_pageviewsPerSession":7.0,"ga_avgTimeOnPage":4.685185185185185,"ga_bounceRate":0.0,"ga_exitRate":14.285714285714285,"view_id":"211669975"} |
traffic_sources | {"ga_date":"2021-02-11","ga_source":"(direct)","ga_medium":"(none)","ga_socialNetwork":"(not set)","ga_users":1,"ga_newUsers":0,"ga_sessions":9,"ga_sessionsPerUser":9.0,"ga_avgSessionDuration":28.77777777777778,"ga_pageviews":63,"ga_pageviewsPerSession":7.0,"ga_avgTimeOnPage":4.685185185185185,"ga_bounceRate":0.0,"ga_exitRate":14.285714285714285,"view_id":"211669975"} |
pages | {"ga_date":"2021-02-11","ga_hostname":"mydemo.com","ga_pagePath":"/home5","ga_pageviews":63,"ga_uniquePageviews":9,"ga_avgTimeOnPage":4.685185185185185,"ga_entrances":9,"ga_entranceRate":14.285714285714285,"ga_bounceRate":0.0,"ga_exits":9,"ga_exitRate":14.285714285714285,"view_id":"211669975"} |
locations | {"ga_date":"2021-02-11","ga_continent":"Americas","ga_subContinent":"Northern America","ga_country":"United States","ga_region":"Iowa","ga_metro":"Des Moines-Ames IA","ga_city":"Des Moines","ga_users":1,"ga_newUsers":0,"ga_sessions":1,"ga_sessionsPerUser":1.0,"ga_avgSessionDuration":29.0,"ga_pageviews":7,"ga_pageviewsPerSession":7.0,"ga_avgTimeOnPage":4.666666666666667,"ga_bounceRate":0.0,"ga_exitRate":14.285714285714285,"view_id":"211669975"} |
monthly_active_users | {"ga_date":"2021-02-11","ga_30dayUsers":1,"view_id":"211669975"} |
four_weekly_active_users | {"ga_date":"2021-02-11","ga_28dayUsers":1,"view_id":"211669975"} |
two_weekly_active_users | {"ga_date":"2021-02-11","ga_14dayUsers":1,"view_id":"211669975"} |
weekly_active_users | {"ga_date":"2021-02-11","ga_7dayUsers":1,"view_id":"211669975"} |
daily_active_users | {"ga_date":"2021-02-11","ga_1dayUsers":1,"view_id":"211669975"} |
devices | {"ga_date":"2021-02-11","ga_deviceCategory":"desktop","ga_operatingSystem":"Macintosh","ga_browser":"Chrome","ga_users":1,"ga_newUsers":0,"ga_sessions":9,"ga_sessionsPerUser":9.0,"ga_avgSessionDuration":28.77777777777778,"ga_pageviews":63,"ga_pageviewsPerSession":7.0,"ga_avgTimeOnPage":4.685185185185185,"ga_bounceRate":0.0,"ga_exitRate":14.285714285714285,"view_id":"211669975"} |
Any custom reports | See below for details. |
Reach out to us on Slack or create an issue if you need to send custom Google Analytics report data with Airbyte.
Rate Limits and Performance Considerations (Airbyte Open Source)
- Number of requests per day per project: 50,000
- Number of requests per view (profile) per day: 10,000 (cannot be increased)
- Number of requests per 100 seconds per project: 2,000
- Number of requests per 100 seconds per user per project: 100 (can be increased in Google API Console to 1,000).
The Google Analytics connector should not run into the "requests per 100 seconds" limitation under normal usage. Create an issue if you see any rate limit issues that are not automatically retried successfully and try increasing the window_in_days
value.
Sampled data in reports
If you are not on the Google Analytics 360 tier, the Google Analytics API may return sampled data if the amount of data in your Google Analytics account exceeds Google's pre-determined compute thresholds. This means the data returned in the report is an estimate which may have some inaccuracy. This Google page provides a comprehensive overview of how Google applies sampling to your data.
In order to minimize the chances of sampling being applied to your data, Airbyte makes data requests to Google in one day increments (the smallest allowed date increment). This reduces the amount of data the Google API processes per request, thus minimizing the chances of sampling being applied. The downside of requesting data in one day increments is that it increases the time it takes to export your Google Analytics data. If sampling is not a concern, you can override this behavior by setting the optional window_in_day
parameter to specify the number of days to look back and avoid sampling.
When sampling occurs, a warning is logged to the sync log.
Requesting Custom Reports
Custom Reports allow for flexibility in the reporting dimensions and metrics to meet your specific use case. Use the GA4 Query Explorer to help build your report. To ensure your dimensions and metrics are compatible, you can also refer to the GA4 Dimensions & Metrics Explorer.
A custom report is formatted as: [{"name": "<report-name>", "dimensions": ["<dimension-name>", ...], "metrics": ["<metric-name>", ...]}]
Example of a custom report:
[
{
"name": "page_views_and_users",
"dimensions": [
"ga:date",
"ga:pagePath",
"ga:sessionDefaultChannelGrouping"
],
"metrics": ["ga:screenPageViews", "ga:totalUsers"]
}
]
Multiple custom reports should be entered with a comma separator. Each custom report is created as it's own stream. Example of multiple custom reports:
[
{
"name": "page_views_and_users",
"dimensions": ["ga:date", "ga:pagePath"],
"metrics": ["ga:screenPageViews", "ga:totalUsers"]
},
{
"name": "sessions_by_region",
"dimensions": ["ga:date", "ga:region"],
"metrics": ["ga:totalUsers", "ga:sessions"]
}
]
Custom reports can also include segments and filters to pull a subset of your data. The report should be formatted as:
[
{
"name": "<report-name>",
"dimensions": ["<dimension-name>", ...],
"metrics": ["<metric-name>", ...],
"segments": ["<segment-id-or-dynamic-segment-name>", ...],
"filter": "<filter-name>"
}
]
- When using segments, make sure you also add the
ga:segment
dimension.
Example of a custom report with segments and/or filters:
[
{
"name": "page_views_and_users",
"dimensions": ["ga:date", "ga:pagePath", "ga:segment"],
"metrics": ["ga:sessions", "ga:totalUsers"],
"segments": ["ga:sessionSource!=(direct)"],
"filter": ["ga:sessionSource!=(direct);ga:sessionSource!=(not set)"]
}
]
To create a list of dimensions, you can use default Google Analytics dimensions (listed below) or custom dimensions if you have some defined. Each report can contain no more than 7 dimensions, and they must all be unique. The default Google Analytics dimensions are:
ga:browser
ga:city
ga:continent
ga:country
ga:date
ga:deviceCategory
ga:hostname
ga:medium
ga:metro
ga:operatingSystem
ga:pagePath
ga:region
ga:socialNetwork
ga:source
ga:subContinent
To create a list of metrics, use a default Google Analytics metric (values from the list below) or custom metrics if you have defined them. A custom report can contain no more than 10 unique metrics. The default available Google Analytics metrics are:
ga:14dayUsers
ga:1dayUsers
ga:28dayUsers
ga:30dayUsers
ga:7dayUsers
ga:avgSessionDuration
ga:avgTimeOnPage
ga:bounceRate
ga:entranceRate
ga:entrances
ga:exitRate
ga:exits
ga:newUsers
ga:pageviews
ga:pageviewsPerSession
ga:sessions
ga:sessionsPerUser
ga:uniquePageviews
ga:users
Incremental sync is supported only if you add ga:date
dimension to your custom report.
Limitations & Troubleshooting
Expand to see details about Google Analytics v4 connector limitations and troubleshooting.
Connector limitations
Rate limiting
- Number of requests per day per project: 50,000
- Number of requests per view (profile) per day: 10,000 (cannot be increased)
- Number of requests per 100 seconds per project: 2,000
- Number of requests per 100 seconds per user per project: 100 (can be increased in Google API Console to 1,000).
The Google Analytics connector should not run into the "requests per 100 seconds" limitation under normal usage. Create an issue if you see any rate limit issues that are not automatically retried successfully and try increasing the window_in_days
value.
Troubleshooting
- Check out common troubleshooting issues for the Google Analytics v4 source connector on our Airbyte Forum.