create_analytics_custom_metric
Register a GA4 custom metric
Description
Register an event parameter the site ALREADY SENDS as a GA4 custom METRIC, so reports can SUM or AVERAGE it. This is the other half of the pair: a custom DIMENSION makes a value something you can group BY, a custom METRIC makes it something you can TOTAL — 'order_value' as a dimension gives you a list of prices, as a metric it gives you revenue. TELL THE USER TWO THINGS BEFORE CALLING: a GA4 custom metric CANNOT be deleted, only archived, and a property is capped at 50 (125 on Analytics 360) — a duplicate or a typo permanently burns a slot, so run list_analytics_definitions first, which lists metrics beside dimensions. measurementUnit IS REQUIRED and is never guessed for you: STANDARD for a plain count or quantity, CURRENCY for money, SECONDS/MINUTES/HOURS for durations. CURRENCY additionally REQUIRES restrictedMetricType (REVENUE_DATA for money coming in, COST_DATA for money going out) and every other unit REFUSES it — both directions are refused before the call is made, because Google's own error names neither field. METRICS ARE EVENT-SCOPED ONLY, unlike dimensions, which take EVENT | USER | ITEM. Not retroactive: it collects from creation onward. The result is READ BACK from Google, never echoed from the request. Needs edit access on the property. 0 credits.
Parameters
| Parameter | Type | Description |
|---|---|---|
propertyrequired | string | NUMERIC GA4 property id from list_analytics_properties — never the G-XXXXXXX Measurement ID |
parameterNamerequired | string | the event parameter GA4 already collects, e.g. 'order_value' — NOT the report label. Letters, digits and underscores, starting with a letter, max 40 characters |
displayName | string | the label shown in reports; defaults to parameterName, max 82 characters |
measurementUnitrequired | "STANDARD" | "CURRENCY" | "FEET" | "METERS" | "KILOMETERS" | "MILES" | "MILLISECONDS" | "SECONDS" | "MINUTES" | "HOURS" | REQUIRED — Google marks it Required and there is no safe default |
restrictedMetricType | "COST_DATA" | "REVENUE_DATA"[] | REQUIRED when measurementUnit is CURRENCY, and refused for every other unit |
scope | "EVENT" | EVENT is the only scope GA4 accepts for a metric, and it is immutable |
description | string | ≤150 characters |
Example call
Every required parameter is shown, filled from the schema where it gives a value and otherwise with a placeholder naming the type. Replace the placeholders with real values. The same call works on the MCP server, the CLI and POST https://app.hermoso.ai/v1/tools/create_analytics_custom_metric.
MCP (tools/call)
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_analytics_custom_metric","arguments":{"property":"<string>","parameterName":"<string>","measurementUnit":"<one of the listed values>"}}}
CLI
hermoso call create_analytics_custom_metric --json '{"property":"<string>","parameterName":"<string>","measurementUnit":"<one of the listed values>"}'
Credits
Credits are spent only on two things: running an AI model (image, video, voice, text, planning, post-production) and Ad Spy research. See Credits & costs.
Related tools
list_analytics_definitionsList a GA4 property’s key events and custom dimensionsdelete_analytics_key_eventStop counting a GA4 event as a conversionarchive_analytics_custom_metricArchive a GA4 custom metric (one-way)archive_analytics_custom_dimensionArchive a GA4 custom dimensioncheck_analytics_compatibilityCheck a GA4 report will work, before running itlist_analytics_metadataWhat a GA4 property can be askedcreate_analytics_custom_dimensionCreate a GA4 custom dimensioncreate_analytics_key_eventMark a GA4 event as a key event (conversion)analytics_realtimeWho is on the site right now (GA4 realtime)analytics_reportRun a GA4 report