Prova il server MCP per Google Analytics. Installa da
GitHub e consulta l'
annuncio per maggiori dettagli.
Metric
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Le misurazioni quantitative di un report. Ad esempio, la metrica eventCount
è il numero totale di eventi. Per le richieste sono consentite fino a 10 metriche.
Rappresentazione JSON |
{
"name": string,
"expression": string,
"invisible": boolean
} |
Campi |
name |
string
Il nome della metrica. Consulta Metriche API per un elenco dei nomi delle metriche supportati dai principali metodi di generazione dei report, come runReport e batchRunReports . Consulta Metriche in tempo reale per l'elenco dei nomi delle metriche supportati dal metodo runRealtimeReport . Consulta Metriche della canalizzazione per l'elenco dei nomi delle metriche supportati dal metodo runFunnelReport . Se expression viene specificato, name può essere qualsiasi stringa tu voglia all'interno del set di caratteri consentito. Ad esempio, se expression è screenPageViews/sessions , puoi chiamare questa metrica per il nome = viewsPerSession . I nomi delle metriche scelti devono corrispondere all'espressione regolare ^[a-zA-Z0-9_]$ . Le metriche fanno riferimento da name in metricFilter , orderBys e nella metrica expression .
|
expression |
string
Un'espressione matematica per le metriche derivate. Ad esempio, la metrica Conteggio eventi per utente è eventCount/totalUsers .
|
invisible |
boolean
Indica se una metrica è invisibile nella risposta del report. Se una metrica non è visibile, non genera una colonna nella risposta, ma può essere utilizzata in metricFilter , orderBys o in una metrica expression .
|
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[[["\u003cp\u003eMetrics quantify report data, such as the total events with \u003ccode\u003eeventCount\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can request up to 10 metrics in a report.\u003c/p\u003e\n"],["\u003cp\u003eMetrics are defined by \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003eexpression\u003c/code\u003e for calculations, and \u003ccode\u003einvisible\u003c/code\u003e to control visibility.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ename\u003c/code\u003e can be a standard metric or a custom name when \u003ccode\u003eexpression\u003c/code\u003e is used.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eexpression\u003c/code\u003e enables creating calculated metrics like "Event count per user" (\u003ccode\u003eeventCount/totalUsers\u003c/code\u003e).\u003c/p\u003e\n"]]],["This document outlines the structure for defining quantitative measurements (metrics) within a report. Each metric has a `name` (a string that can be custom when using an `expression`), an optional `expression` (a mathematical formula to derive the metric), and an `invisible` boolean, the metric can be excluded from the report's output but used for filtering, ordering, or in other metrics' `expression` . Up to 10 metrics are allowed per request.\n"],null,["# Metric\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nThe quantitative measurements of a report. For example, the metric `eventCount` is the total number of events. Requests are allowed up to 10 metrics.\n\n| JSON representation |\n|------------------------------------------------------------------------|\n| ``` { \"name\": string, \"expression\": string, \"invisible\": boolean } ``` |\n\n| Fields ||\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` The name of the metric. See the [API Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics) for the list of metric names supported by core reporting methods such as `runReport` and `batchRunReports`. See [Realtime Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics) for the list of metric names supported by the `runRealtimeReport` method. See [Funnel Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema#metrics) for the list of metric names supported by the `runFunnelReport` method. If `expression` is specified, `name` can be any string that you would like within the allowed character set. For example if `expression` is `screenPageViews/sessions`, you could call that metric's name = `viewsPerSession`. Metric names that you choose must match the regular expression `^[a-zA-Z0-9_]$`. Metrics are referenced by `name` in `metricFilter`, `orderBys`, and metric `expression`. |\n| `expression` | `string` A mathematical expression for derived metrics. For example, the metric Event count per user is `eventCount/totalUsers`. |\n| `invisible` | `boolean` Indicates if a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in `metricFilter`, `orderBys`, or a metric `expression`. |"]]