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) Audience resource to update audience configurations within a Google Analytics property. It allows users to modify existing audience definitions by sending update requests to the Google Analytics Admin API.

Common scenarios where this node is beneficial include:

  • Updating audience criteria or metadata in Google Analytics properties.
  • Automating audience management workflows as part of larger data processing or marketing automation pipelines.
  • Synchronizing audience updates from external systems into Google Analytics.

For example, a marketing team could use this node to programmatically update an audience's definition based on new segmentation rules without manual intervention in the Google Analytics UI.

Properties

Name Meaning
Property ID The identifier of the Google Analytics property containing the audience to update.
Audience ID The unique identifier of the audience to be updated within the specified property.
Query Parameters Optional parameters for the request such as updateMask (fields to update), filters, paging, etc.
Request Body JSON object representing the fields and values to update in the audience resource.

Details on Query Parameters options (selected):

  • Calculated Metric ID: ID used 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 items to return.
  • Page Token: Token for pagination continuation.
  • Show Deleted: Whether to include soft-deleted properties.
  • Universal Analytics Property ID: UA property linked to GA4 property.
  • Update Mask: Comma-separated list of snake_case field names to update.

Output

The node outputs a JSON array where each element corresponds to the parsed JSON response from the Google Analytics API for the update operation. This typically includes the updated audience resource representation returned by the API.

No binary data output is involved.

Dependencies

  • Requires valid Google Analytics API OAuth2 credentials configured in n8n.
  • Uses the Google Analytics Admin API v1alpha endpoint (https://analyticsadmin.googleapis.com/v1alpha).
  • The node performs authenticated HTTP requests using OAuth2 tokens.

Troubleshooting

  • Missing Credentials Error: If the node throws "Missing Google Analytics API Credentials", ensure that OAuth2 credentials for Google Analytics are properly set up and connected.
  • Required Parameter Errors: Errors like "Property ID is required" or "Audience ID is required" indicate missing mandatory inputs; verify these are provided.
  • API Errors: Any error returned by the Google Analytics API will be wrapped and reported with the message prefix "Error calling Google Analytics API". Check the API response details for causes such as invalid IDs, insufficient permissions, or malformed request bodies.
  • Update Mask Usage: When updating partial fields, ensure the updateMask query parameter correctly lists the fields to update in snake_case format to avoid partial update failures.

Links and References


This summary focuses on the "Admin (V1Alpha) - Audience" resource and the "Update Audience" operation as requested, describing the input properties, output structure, dependencies, and common troubleshooting points based on static analysis of the provided source code and property definitions.

Discussion