Skip to main content

Google Analytics Data Source

Follow the instructions below to create a new data flow that ingests data from a Google Analytics source in Nexla.
ganalytics_api.png

Google Analytics

Create a New Data Flow

  1. To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Then, select the desired flow type from the list, and click the Create button.

  2. Select the Google Analytics connector tile from the list of available connectors. 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.

  3. In Nexla, Google Analytics data sources can be created using pre-built endpoint templates, which expedite source setup for common Google Analytics endpoints. Each template is designed specifically for the corresponding Google Analytics endpoint, making source configuration easy and efficient.
    • To configure this source using a template, follow the instructions in Configure Using a Template.

    Google Analytics sources can also be configured manually, allowing you to ingest data from Google Analytics endpoints not included in the pre-built templates or apply further customizations to exactly suit your needs.
    • To configure this source manually, follow the instructions in Configure Manually.

Configure Using a Template

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.

Endpoint Settings

  • 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.

Endpoint Testing

Once the selected endpoint template has been configured, Nexla can retrieve a sample of the data that will be fetched according to the current settings. This allows users to verify that the source is configured correctly before saving.

  • To test the current endpoint configuration, click the Test button to the right of the endpoint selection menu. Sample data will be fetched & displayed in the Endpoint Test Result panel on the right.

  • If the sample data is not as expected, review the selected endpoint and associated settings, and make any necessary adjustments. Then, click the Test button again, and check the sample data to ensure that the correct information is displayed.

Configure Manually

Google Analytics data sources can be manually configured to ingest data from any valid Google Analytics API endpoint. Manual configuration provides maximum flexibility for accessing endpoints not covered by pre-built templates or when you need custom API configurations.

With manual configuration, you can also create more complex Google Analytics sources, such as sources that use chained API calls to fetch data from multiple endpoints or sources that require custom authentication headers or request parameters.

API Method

  1. To manually configure this source, select the Advanced tab at the top of the configuration screen.

  2. Select the API method that will be used for calls to the Google Analytics API from the Method pulldown menu. The most common methods are:

    • GET: For retrieving data from the API
    • POST: For sending data to the API or triggering actions
    • PUT: For updating existing data
    • PATCH: For partial updates to existing data
    • DELETE: For removing data

API Endpoint URL

  1. Enter the URL of the Google Analytics API endpoint from which this source will fetch data in the Set API URL field. This should be the complete URL including the protocol (https://) and any required path parameters. Google Analytics API endpoints typically follow different patterns depending on the API service:
    • Management API v3: https://www.googleapis.com/analytics/v3/{endpoint_path}
    • Reporting API v3: https://www.googleapis.com/analytics/v3/{endpoint_path}
    • Admin API v1: https://analyticsadmin.googleapis.com/v1/{endpoint_path}
    • Data API v1: https://analyticsdata.googleapis.com/v1/{endpoint_path}

Ensure the API endpoint URL is correct and accessible with your current credentials. You can test the endpoint using the Test button after configuring the URL. The endpoint requires OAuth 2.0 authentication via the Authorization: Bearer {token} header, which is handled automatically by your credential configuration. For detailed information about Google Analytics API endpoints and available APIs, see the Google Analytics API documentation.