Skip to main content

Google Analytics

Google Analytics is a comprehensive web analytics platform that provides detailed insights into website traffic, user behavior, conversion tracking, and marketing performance, enabling businesses to optimize their digital presence and make data-driven decisions to improve user experience and business outcomes.

Google Analytics icon

Power end-to-end data operations for your Google Analytics API with Nexla. Our bi-directional Google Analytics connector is purpose-built for Google Analytics, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Google Analytics or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Google Analytics workflows fast, secure, and fully governed.

Features

Type: API

SourceDestination

  • Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
  • Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
  • API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
  • Request optimization with intelligent batching, retry, and caching to minimize API calls and costs

Prerequisites

Before creating a Google Analytics credential, you need to have a Google Analytics account with API access enabled. Google Analytics uses OAuth 2.0 authentication to securely authenticate API requests.

To set up OAuth 2.0 authentication for Google Analytics, you need to have a Google account with access to Google Analytics. The OAuth 2.0 authorization flow allows Nexla to access your Google Analytics data on your behalf. The default access scope is https://www.googleapis.com/auth/analytics.readonly, which provides read-only access to your Google Analytics data. For detailed information about Google Analytics API authentication and setup, refer to the Google Analytics API documentation.

Authenticate

Credentials required

FieldRequiredSecretDescription
GA Access ScopeNoNoGA Access Scope Allowed values: https://www.googleapis.com/auth/analytics.readonly

Create a credential in Nexla

  1. To create a new Google Analytics credential, after selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

New Credential Overlay – Google Analytics

GoogleAnalyticsCred.png
  1. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

    Google Analytics uses OAuth 2.0 authentication with Nexla's public application. The OAuth 2.0 authorization flow is handled automatically by Nexla, and most OAuth settings are pre-configured.

  2. Select the access scope for your Google Analytics credential from the GA Access Scope dropdown menu. The default scope is https://www.googleapis.com/auth/analytics.readonly, which provides read-only access to your Google Analytics data.

  3. Click the Authorize button to start the OAuth 2.0 authorization flow. You will be redirected to Google's authorization page where you can sign in to your Google account and grant permissions to Nexla.

    The OAuth 2.0 authorization flow allows Nexla to access your Google Analytics account on your behalf. You will be asked to grant permissions for the selected access scope, which provides access to your Google Analytics data. The authorization process is handled automatically by Nexla, and you will be redirected back to Nexla once authorization is complete. The default scope https://www.googleapis.com/auth/analytics.readonly provides read-only access to your Google Analytics data, which is sufficient for most data retrieval operations. For detailed information about Google Analytics OAuth 2.0 setup and available scopes, see the Google Analytics API documentation.

  4. Click the Save button at the bottom of the overlay to save the configured credential. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation and can be selected for use with a new data source or destination.

Use as a data source

To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Google Analytics connector tile, then select the credential that will be used to connect to the Google Analytics instance, and click Next; or, create a new Google Analytics credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Google Analytics endpoints. Each template is designed specifically for the corresponding Google Analytics endpoint, making data source setup easy and efficient. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below. Click on an endpoint to see more information about it and how to configure your data source for this endpoint.

Get all Universal Analytics Account Summaries

Lists account summaries (lightweight tree comprised of accounts/properties/profiles) to which the user has access. This endpoint connects to Google Analytics Management API v3, which supports Universal Analytics properties.

  • This endpoint automatically retrieves all Universal Analytics account summaries from your Google Analytics account. No additional configuration is required beyond selecting this endpoint template.
  • The endpoint uses GET requests to https://www.googleapis.com/analytics/v3/management/accountSummaries. The endpoint URL is automatically constructed based on the Google Analytics Management API base URL.
  • The endpoint uses URL-based pagination, automatically fetching additional pages as needed. When a response includes a nextLink value, Nexla automatically uses it as the URL for the subsequent request to fetch the next page of results.
  • The endpoint will return all account summaries in your Google Analytics account. The response data is extracted from the items array in the API response ($.items[*]), with each account summary processed individually.

This endpoint retrieves account summaries for Universal Analytics properties. Account summaries provide a lightweight tree structure of accounts, properties, and profiles (views) that you have access to. The endpoint uses URL-based pagination (iteration.type: paging.next.url) through the nextLink mechanism. When a response includes a nextLink value, Nexla automatically uses it as the URL for the subsequent request. The response data path is $.items[*], which extracts all items from the items array in the API response. For detailed information about listing account summaries, see the Google Analytics Management API documentation.

Execute Report Query (Universal Analytics): Single Record

Fetches Google Analytics report for Universal Analytics properties and processes entire response as a single record in the Nexset. This endpoint connects to Google Analytics Reporting API v3.

  • Enter the unique ID used to retrieve the Analytics data in the View ID (add prefix ga:) field. This ID is the concatenation of the namespace ga: with the Analytics view (profile) ID (e.g., ga:12345678). The default value is ga: if not specified.

  • Enter the start date for fetching Analytics data in the Start Date (YYYY-MM-DD) field. The value should be in YYYY-MM-DD format. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-2} if not specified.

  • Enter the end date for fetching Analytics data in the End Date (YYYY-MM-DD) field. The value should be in YYYY-MM-DD format. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-1} if not specified.

  • Enter the analytics query that needs to be executed in the Query field. This is usually of the format metrics=<metrics_to_get>&dimensions=<dimensions>&sort=<sort_order> (e.g., metrics=ga:sessions&dimensions=ga:pagePath&sort=-ga:sessions). The default value includes a sample query if not specified.

  • The endpoint uses GET requests to https://www.googleapis.com/analytics/v3/data/ga with query parameters including the view ID, start date, end date, and query string. The endpoint URL is automatically constructed based on the Google Analytics Reporting API base URL and all the parameters.
  • The endpoint uses URL-based pagination, automatically fetching additional pages as needed. When a response includes a nextLink value, Nexla automatically uses it as the URL for the subsequent request to fetch the next page of results.
  • The endpoint will return the complete report response as a single record. The response data is extracted from the root-level object in the API response ($), and Nexla will process the entire response structure as one record.

This endpoint is for Universal Analytics properties and processes the entire report response as a single record. View IDs should include the ga: prefix (e.g., ga:12345678). Date values can use YYYY-MM-DD format or Nexla macros like {now}, {now-1}, etc. The query parameter should follow the format metrics=<metrics>&dimensions=<dimensions>&sort=<sort_order>. The endpoint uses URL-based pagination (iteration.type: paging.next.url) through the nextLink mechanism. The response data path is $, which extracts the entire root-level object from the API response. For detailed information about executing report queries, see the Google Analytics Reporting API documentation.

Execute Report Query (Universal Analytics): Multiple Records

Fetches Google Analytics report for Universal Analytics properties and processes each row of data as a unique record in the Nexset. This endpoint connects to Google Analytics Reporting API v3.

  • Enter the unique ID used to retrieve the Analytics data in the View ID (add prefix ga:) field. This ID is the concatenation of the namespace ga: with the Analytics view (profile) ID (e.g., ga:12345678). The default value is ga: if not specified.

  • Enter the start date for fetching Analytics data in the Start Date (YYYY-MM-DD) field. The value should be in YYYY-MM-DD format. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-2} if not specified.

  • Enter the end date for fetching Analytics data in the End Date (YYYY-MM-DD) field. The value should be in YYYY-MM-DD format. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-1} if not specified.

  • Enter the analytics query that needs to be executed in the Query field. This is usually of the format metrics=<metrics_to_get>&dimensions=<dimensions>&sort=<sort_order> (e.g., metrics=ga:sessions&dimensions=ga:pagePath&sort=-ga:sessions). The default value includes a sample query if not specified.

  • The endpoint uses GET requests to https://www.googleapis.com/analytics/v3/data/ga with query parameters including the view ID, start date, end date, and query string. The endpoint URL is automatically constructed based on the Google Analytics Reporting API base URL and all the parameters.
  • The endpoint does not use pagination and returns all report rows in a single request.
  • The endpoint will return each row of report data as a separate record. The response data is extracted from the rows array in the API response ($.rows[*]), with each row processed individually. Additional metadata including column headers and query information is also included in each record.

This endpoint is for Universal Analytics properties and processes each row of report data as a separate record. View IDs should include the ga: prefix (e.g., ga:12345678). Date values can use YYYY-MM-DD format or Nexla macros like {now}, {now-1}, etc. The query parameter should follow the format metrics=<metrics>&dimensions=<dimensions>&sort=<sort_order>. The endpoint uses a static URL (iteration.type: static.url) and does not require pagination. The response data path is $.rows[*], which extracts all items from the rows array in the API response. Additional metadata from columnHeaders and query is also included in each record. For detailed information about executing report queries, see the Google Analytics Reporting API documentation.

Get all GA4 Account Summaries

Lists account summaries (lightweight tree comprised of accounts/properties/profiles) to which the user has access. This endpoint connects to Google Analytics Admin API service, which only supports GA4 property management.

  • Enter the version of Google Analytics Admin API you wish to access in the Google Analytics Admin API Version field. The default value is v1beta if not specified.

  • The endpoint uses GET requests to https://analyticsadmin.googleapis.com/{api_version}/accountSummaries where {api_version} is the Google Analytics Admin API Version you provide. The endpoint URL is automatically constructed based on the Google Analytics Admin API base URL and the API version.
  • The endpoint uses token-based pagination, automatically fetching additional pages as needed. When a response includes a nextPageToken value, Nexla automatically uses it as the pageToken query parameter for the subsequent request to fetch the next page of results.
  • The endpoint will return all GA4 account summaries in your Google Analytics account. The response data is extracted from the accountSummaries array in the API response ($.accountSummaries[*]), with each account summary processed individually.

This endpoint retrieves account summaries for GA4 properties. Account summaries provide a lightweight tree structure of accounts and properties that you have access to. The endpoint uses token-based pagination (iteration.type: paging.next.token) through the nextPageToken mechanism. When a response includes a nextPageToken value, Nexla automatically uses it as the pageToken query parameter for the subsequent request. The response data path is $.accountSummaries[*], which extracts all items from the accountSummaries array in the API response. For detailed information about listing GA4 account summaries, see the Google Analytics Admin API documentation.

Run Report (GA4 Properties): Multiple Records

Fetches Google Analytics report for GA4 properties and processes each row of data as a unique record in the Nexset. This endpoint connects to Google Analytics Data API.

  • Enter the version of Google Analytics Data API you wish to access in the Google Analytics Data API Version field. The default value is v1beta if not specified.

  • Enter the Google Analytics GA4 property identifier whose events are tracked in the GA4 Property ID field. You can find the Property ID in your Google Analytics account. The Property ID is required for this endpoint.

  • Enter the dimensions requested and displayed in the Dimensions field. This should be an array of valid dimension objects (e.g., [{"name": "city"}]). The default value includes a sample dimension if not specified.

  • Enter the metrics requested and displayed in the Metrics field. This should be an array of valid metric objects (e.g., [{"name": "activeUsers"}]). The default value includes a sample metric if not specified.

  • Enter the inclusive start date for the query in the Start Date (YYYY-MM-DD) field. The format NdaysAgo, yesterday, or today is also accepted. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-2} if not specified.

  • Enter the inclusive end date for the query in the End Date (YYYY-MM-DD) field. The format NdaysAgo, yesterday, or today is also accepted. You can also use Nexla macros like {now}, {now - 1}, etc. The default value is {now-1} if not specified.

  • The endpoint uses POST requests to https://analyticsdata.googleapis.com/{api_version}/properties/{property_id}:runReport with a JSON body containing dimensions, metrics, and date ranges. The endpoint URL is automatically constructed based on the Google Analytics Data API base URL, the API version, and the property ID.
  • The endpoint uses incrementing offset pagination, automatically fetching additional pages as needed. Pagination starts from offset 0 and increments by the limit value for each subsequent page. Nexla will continue fetching pages until all report rows are retrieved.
  • The endpoint will return each row of report data as a separate record. The response data is extracted from the rows array in the API response ($.rows[*]), with each row processed individually. Additional metadata including dimension headers, metric headers, and metadata is also included in each record.

This endpoint is for GA4 properties and processes each row of report data as a separate record. Property IDs can be found in your Google Analytics account settings. Dimensions and metrics should be arrays of objects with name properties. Date values can use YYYY-MM-DD format, special formats like NdaysAgo, yesterday, or today, or Nexla macros like {now}, {now-1}, etc. The endpoint uses incrementing offset pagination (iteration.type: paging.incrementing.offset) starting from offset 0. The response data path is $.rows[*], which extracts all items from the rows array in the API response. Additional metadata from dimensionHeaders, metricHeaders, and metadata is also included in each record. For detailed information about running GA4 reports, see the Google Analytics Data API documentation.

Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving. If the sample data is not as expected, review the selected endpoint and associated settings, make any necessary adjustments, and test again.

Manual configuration

Google Analytics data sources can also be manually configured to ingest data from any valid Google Analytics API endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.

Google Analytics API endpoints vary by service. The Management API v3 and Reporting API v3 both use https://www.googleapis.com/analytics/v3/{endpoint_path}, the Admin API uses https://analyticsadmin.googleapis.com/v1/{endpoint_path}, and the Data API uses https://analyticsdata.googleapis.com/v1/{endpoint_path}. All endpoints require OAuth 2.0 authentication via the Authorization: Bearer {token} header, which is handled automatically by your credential configuration.

Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Google Analytics data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.