Google Analytics icon

Google Analytics

Use the Google Analytics API

Actions236

Admin (V1Beta) - Custom Metric → Create Custom Metric

AI-generated

Overview

This node integrates with the Google Analytics API, specifically supporting a wide range of administrative and data management operations across different versions (v1alpha, v1beta) and data APIs. For the Admin (V1Beta) - Custom Metric resource with the Create Custom Metric operation, it allows users to create custom metrics within a specified Google Analytics property.

This is useful for organizations that want to define their own metrics tailored to specific business needs beyond the standard metrics provided by Google Analytics. For example, a marketing team might create a custom metric to track a unique conversion event or a sales KPI that isn't available by default.

Properties

Name Meaning
Property ID The identifier of the Google Analytics property where the custom metric will be created.
Query Parameters Optional additional parameters to customize the request, such as filters, pagination, etc.
Request Body JSON object containing the details of the custom metric to create (e.g., name, expression).

Details on Query Parameters (optional)

  • Calculated Metric ID: ID to use 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: Max number of report tasks to return.
  • Page Token: Continuation token for pagination.
  • Show Deleted: Whether to include soft-deleted properties.
  • Universal Analytics Property ID: UA property to look up connected GA4 property.
  • Update Mask: List of fields to update (snake case).

Output

The node outputs an array of JSON objects representing the response from the Google Analytics API after creating the custom metric. This typically includes the newly created custom metric's details such as its ID, name, scope, and other configuration attributes.

No binary data output is involved in this operation.

Dependencies

  • Requires valid Google Analytics API OAuth2 credentials configured in n8n.
  • The node uses the Google Analytics Admin API endpoint https://analyticsadmin.googleapis.com/v1beta.
  • Proper permissions on the Google Analytics property are necessary to create custom metrics.

Troubleshooting

  • Missing Credentials Error: If the node throws "Missing Google Analytics API Credentials," ensure that OAuth2 credentials for Google Analytics API are properly set up in n8n.
  • Required Parameter Missing: Errors like "Property ID is required" indicate that the Property ID input was not provided; make sure to specify it.
  • API Errors: Any error returned by the Google Analytics API will be wrapped and shown with the message "Error calling Google Analytics API." Check the API response for details such as permission issues or invalid request body.
  • Invalid JSON in Request Body: Ensure the JSON entered in the Request Body field is valid and matches the expected schema for creating a custom metric.

Links and References


This summary focuses on the "Admin (V1Beta) - Custom Metric" resource and the "Create Custom Metric" operation as requested.

Discussion