Google Analytics icon

Google Analytics

Use the Google Analytics API

Actions84

Overview

This node integrates with the Google Analytics API, specifically supporting the creation of a Calculated Metric within the Admin (V1Alpha) resource. It allows users to create custom calculated metrics for a specified property in Google Analytics, enabling advanced data analysis and reporting tailored to specific business needs.

Typical use cases include:

  • Defining new calculated metrics based on existing data to track custom KPIs.
  • Automating the creation of calculated metrics as part of a larger analytics workflow.
  • Managing Google Analytics properties programmatically without manual intervention.

For example, a marketing analyst could use this node to create a calculated metric that combines multiple standard metrics into a single performance indicator, which can then be used in reports or dashboards.

Properties

Name Meaning
Property ID The identifier of the Google Analytics property where the calculated metric will be created.
Query Parameters Optional additional parameters for the API request, including:
- Calculated Metric ID: ID to assign to the calculated metric (string).
- Entity: Level of data access report (property or account level) (string).
- Filter: Expression to filter results (string).
- Names: Names of access bindings to retrieve (string).
- Page Size: Maximum number of report tasks to return (number).
- Page Token: Continuation token for pagination (string).
- Show Deleted: Whether to include soft-deleted properties (boolean).
- Universal Analytics Property ID: UA property to look up connected GA4 property (string).
- Update Mask: List of fields to update (snake case string).
Request Body JSON object containing the details of the calculated metric to create, such as name, expression, formatting, etc.

Output

The node outputs an array of JSON objects representing the response from the Google Analytics API after creating the calculated metric. This typically includes the full details of the newly created calculated metric, such as its ID, name, expression, and other metadata.

No binary data output is involved.

Dependencies

  • Requires a valid Google Analytics API OAuth2 credential configured in n8n.
  • The node uses the Google Analytics Admin API v1alpha endpoint (https://analyticsadmin.googleapis.com/v1alpha).
  • Proper permissions are needed on the Google Analytics property to create calculated metrics.

Troubleshooting

  • Missing Credentials Error: If the node throws "Missing Google Analytics API Credentials," ensure that the OAuth2 credentials for Google Analytics are properly set up and authorized.
  • Required Parameter Errors: Errors like "Property ID is required" indicate that mandatory input parameters were not provided. Verify that all required fields are filled.
  • API Errors: Errors returned by the Google Analytics API will be wrapped with messages like "Error calling Google Analytics API: ...". Check the error message for details, such as permission issues or invalid request body.
  • Invalid JSON in Request Body: Ensure the JSON provided in the Request Body field is correctly formatted.

Links and References


This summary is based on static analysis of the node's source code and provided property definitions.

Discussion