Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Gestire le risposte a un report non è semplice, in particolare se vuoi che la tua soluzione sia flessibile e indipendente dalle dimensioni e dalle metriche effettive scelte nel report.
Per fortuna, la risposta al report è abbastanza completa e include molte informazioni utili.
Intestazioni
Puoi utilizzare le informazioni restituite nelle intestazioni per scegliere come formattare una determinata metrica. Include informazioni sul tipo di metrica, ad esempio se si tratta di una valuta, un rapporto o un conteggio e la valuta in cui si trova, se è un valore monetario.
Qui è dove si ottengono i risultati effettivi del report. Ogni riga di risposta rappresenta una riga del report, che ha un significato diverso in base alle dimensioni scelte.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[[["\u003cp\u003eAdSense report responses provide comprehensive data including headers for metric formatting, rows for results, and totals/averages for calculations.\u003c/p\u003e\n"],["\u003cp\u003eHeaders specify the type and currency of each metric, enabling adaptable handling of report data.\u003c/p\u003e\n"],["\u003cp\u003eReport rows contain the actual values for each dimension and metric selected in the report.\u003c/p\u003e\n"],["\u003cp\u003eTotals and averages are included, with ratios only having an average returned in the totals array.\u003c/p\u003e\n"],["\u003cp\u003eResponses may include the calculated start and end dates when using relative date ranges in reports.\u003c/p\u003e\n"]]],["Report responses include `headers` specifying metric types (e.g., currency, ratio) and formats. `Rows` contain the report's data, with each row's cells corresponding to header-defined metrics and dimensions. `Totals` and `averages` arrays provide aggregate values for relevant metrics, with ratios shown in `totals` only, and `startdate` and `enddate` show calculated date ranges. This detailed structure allows for flexible processing of report data independent of the chosen dimensions and metrics.\n"],null,["# Handle the Results\n\nHandling a report response is not trivial, particularly if you want your solution to be flexible and independent of the actual dimensions and metrics you chose in your report.\n\nThankfully, the report response is pretty complete and includes a lot of useful information.\n\nHeaders\n-------\n\nYou can use the information returned in the headers to choose how to format a particular metric. It includes information on what type of metric it is, whether it's a currency, ratio or tally for example, and what currency it's in, if it's a monetary value.\n\n**Example:**\n\n```carbon\n\"headers\": [\n { \"name\": \"MONTH\", \"type\": \"DIMENSION\" },\n { \"name\": \"CLICKS\", \"type\": \"METRIC_TALLY\" },\n { \"name\": \"EARNINGS\", \"type\": \"METRIC_CURRENCY\", \"currency\": \"USD\" },\n { \"name\": \"AD_REQUESTS_COVERAGE\", \"type\": \"METRIC_RATIO\" }\n]\n```\n\n\u003cbr /\u003e\n\nRows\n----\n\nThis is where you get the actual report results. Each response row represents a report row, which has a different meaning based on your chosen dimensions.\n\n\u003cbr /\u003e\n\n```text\n\"rows\": [\n { \"cells\":\n [ {\"value\": \"2021-01\"}, {\"value\": \"278\"}, {\"value\": \"63.12\"}, {\"value\": \"0.9998\"} ],\n [ {\"value\": \"2021-02\"}, {\"value\": \"39\"}, {\"value\": \"8.46\"}, {\"value\": \"0.9998\"} ]\n }\n]\n```\n\n\u003cbr /\u003e\n\nTotals and averages\n-------------------\n\nWhen you run a report, you also get back the `totals` and `averages` utility arrays, which will contain a value for each appropriate metric.\n| **Note:** If it doesn't make sense for a metric to have a total, if it's a ratio for example, the only calculated value will be the average. However, it will be returned in the `totals` array, instead of the `averages` array.\n\n\u003cbr /\u003e\n\n```text\n\"totals\": {\n \"cells\": [\n {}, {\"value\": \"317\"}, {\"value\": \"71.58\"}, {\"value\": \"0.9998\"}\n ]\n},\n\"averages\": {\n \"cells\": [\n {}, {\"value\": \"158\"}, {\"value\": \"71.58\"}, {\"value\": \"0.9998\"}\n ]\n}\n```\n\n\u003cbr /\u003e\n\nStart and end Dates\n-------------------\n\nIf you're using [relative dates](/adsense/management/reporting/date_ranges#relative), it may sometimes be useful to know what the calculated start and end dates are.\n\n\u003cbr /\u003e\n\n```text\n\"startDate\": {\"year\": 2021, \"month\": 1, \"day\": 1},\n\"endDate\": {\"year\": 2021, \"month\": 2, \"day\": 28}\n```\n\n\u003cbr /\u003e\n\nNext steps\n----------\n\n- [Filtering](/adsense/management/reporting/filtering)\n- [Running Large Reports](/adsense/management/reporting/large_reports)"]]