manage_analytics_calculated_metric
GA4 calculated metrics destructive
Description
THE DERIVED NUMBER A MARKETER ACTUALLY REPORTS — cost per purchase, revenue per session, a margin — built from metrics GA4 already collects and then available to analytics_report like any other metric. action:'list' reads them, 'create' adds one, 'update' changes the formula, name, unit or description, 'delete' removes one (confirm-gated). THE ID IS CHOSEN ONCE AND IS PERMANENT: calculatedMetricId becomes the API name reports ask for (calcMetric:your_id), Google marks it output-only afterwards, and renaming is refused by name rather than silently ignored — so pick it deliberately. The formula takes + - * / and parentheses over metric names and plain numbers, referencing at most 5 unique custom metrics; Google answers a syntax error with the exact position. WATCH invalidMetricReference ON THE WAY BACK: a formula naming a metric this property does not collect is created happily and flagged invalid, and any report using it may fail or return unexpected numbers — report that rather than a clean success. Free.
Parameters
| Parameter | Type | Description |
|---|---|---|
propertyrequired | string | NUMERIC GA4 property id, from list_analytics_properties |
action | "list" | "create" | "update" | "delete" | defaults to 'list' |
calculatedMetricId | string | the API name, e.g. "cost_per_purchase". Required to create and PERMANENT; for update/delete it names the metric |
displayName | string | the name shown in GA4, max 82 characters. Required to create |
formula | string | e.g. "advertiserAdCost / conversions". Required to create |
metricUnit | string | STANDARD | CURRENCY | FEET | MILES | METERS | KILOMETERS | MILLISECONDS | SECONDS | MINUTES | HOURS. Required to create |
description | string | max 4096 characters |
confirm | boolean | must be true to actually delete |
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/manage_analytics_calculated_metric.
MCP (tools/call)
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"manage_analytics_calculated_metric","arguments":{"property":"<string>"}}}
CLI
hermoso call manage_analytics_calculated_metric --json '{"property":"<string>"}'
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
analytics_reportRun a GA4 reportmanage_analytics_channel_groupGA4 channel groups