Google Analytics icon

Google Analytics

Use the Google Analytics API

Actions84

Overview

This node integrates with the Google Analytics API, specifically targeting the Admin (V1Alpha) resource for managing accounts. The "Update Account" operation allows users to update details of a specified Google Analytics account by providing the account ID and the fields to be updated.

Common scenarios where this node is beneficial include automating account management tasks such as updating account settings or metadata without manual intervention. For example, a marketing team could automate updates to account configurations based on external triggers or workflows.

Practical example:

  • Automatically update an account's name or settings when a related CRM record changes.
  • Batch update multiple accounts' properties using n8n workflows.

Properties

Name Meaning
Account ID The unique identifier of the Google Analytics account to update.
Query Parameters Optional parameters to customize the request, including:
- Calculated Metric ID: ID for calculated metrics.
- 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 report tasks to return.
- Page Token: Continuation token for pagination.
- Show Deleted: Include soft-deleted properties in results (boolean).
- Universal Analytics Property ID: UA property to look up connected GA4 property.
- Update Mask: Comma-separated list of snake_case field names to update.
Request Body JSON object containing the fields and values to update in the account.

Output

The output is a JSON array containing the response from the Google Analytics API after performing the update operation. This typically includes the updated account object with its current state reflecting the applied changes.

No binary data output is involved.

Example output structure (simplified):

[
  {
    "name": "Updated Account Name",
    "accountId": "123456789",
    "otherAccountFields": "updated values"
  }
]

Dependencies

  • Requires a valid Google Analytics API OAuth2 credential configured in n8n.
  • The node uses the Google Analytics Admin API v1alpha endpoint.
  • Network access to https://analyticsadmin.googleapis.com/v1alpha is required.

Troubleshooting

  • Missing Credentials Error: If the node throws "Missing Google Analytics API Credentials," ensure that the OAuth2 credentials are properly set up and selected in the node.
  • Required Parameter Errors: Errors like "Account ID is required" indicate that mandatory input fields are missing. Verify that the Account ID and other required IDs are provided.
  • 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 error message and stack trace for details.
  • Invalid Update Mask: If the update mask does not match the fields in the request body or uses incorrect naming, the API may reject the request. Use snake_case field names matching the API specification.

Links and References

Discussion