Google Analytics icon

Google Analytics

Use the Google Analytics API

Actions84

Overview

This node interacts with the Google Analytics API, specifically targeting the Admin (V1Alpha) resource for managing accounts. The "List Accounts" operation retrieves all Google Analytics accounts accessible by the authenticated user. This is useful for scenarios where you want to programmatically fetch and manage your Google Analytics accounts within an automation workflow.

Practical examples include:

  • Automatically listing all Google Analytics accounts to display or process them in subsequent workflow steps.
  • Integrating account data retrieval into reporting or auditing workflows.
  • Using the list of accounts to dynamically select or configure further analytics operations.

Properties

Name Meaning
Query Parameters A collection of optional parameters to filter or paginate the list of accounts. Options include:
- Calculated Metric ID: ID for a calculated metric.
- Entity: Level of data access report (property or account).
- Filter: Expression to filter results.
- Names: Names of access bindings to retrieve.
- Page Size: Maximum number of accounts to return (default 10).
- Page Token: Token for fetching next page of results.
- Show Deleted: Whether to include soft-deleted ("trashed") properties (default true).
- Universal Analytics Property ID: UA property to look up connected GA4 property.
- Update Mask: List of fields to update (snake case).

Output

The output is a JSON array containing the response from the Google Analytics API for the list accounts request. Each item in the array represents an account object with its associated details as returned by the API.

The node does not output binary data.

Dependencies

  • Requires an OAuth2 API credential for Google Analytics API authentication.
  • The node uses the Google Analytics Admin API endpoint https://analyticsadmin.googleapis.com/v1alpha/accounts for this operation.
  • Proper configuration of the OAuth2 credentials in n8n is necessary to authenticate requests.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that a valid Google Analytics API OAuth2 credential is configured and selected.
  • Account ID Required: For some operations, an Account ID is mandatory. For the "List Accounts" operation, no Account ID is required, but if used incorrectly with other operations, this error may appear.
  • API Errors: Errors returned from the Google Analytics API will be wrapped and shown with the message prefix "Error calling Google Analytics API". Check the detailed error message and stack trace for troubleshooting.
  • Pagination Issues: When retrieving large numbers of accounts, use the "Page Size" and "Page Token" query parameters to paginate through results properly.

Links and References

Discussion