Ce document a été mis à jour.
La traduction en Français (France) n’est pas encore terminée.
Anglais mis à jour : 13 sept.

Reporting API

Below is a guide for integrating the Audience Network Reporting API to access performance data for your apps.

Prerequisites

Recommendations

  • When requesting large amounts of data, cursor-based pagination is recommended. Paginated results are returned immediately for synchornous requests and is the preferred method for retrieving breakdowns.

Limitations

  • Dates always refer to PDT unless specifed otherwise
  • Revenue metrics may not be available if the number of impressions is too small
    • If the data for is not available with a specific breakdown, we recommend querying the total for the time period
  • User access tokens generated in Monetization Manager or Business Manager cannot be used

Updates for Aggregation

Daily Impressions and Revenue

Query impressions and revenue for the placement on 1-4 May 2022 with a daily breakdown.

What might change: You may see that some data is unavailable following the change.

The revenue and CPM data points that are not available due to insufficient number of impressions will not be included in the results field in the API response. Instead, the corresponding entries will be added to the omitted_results field. They will include the time, metric and breakdowns fields, but they will not include the value - please refer to the sample response at the bottom of this page.

Request Syntax

Use the GET ID > adnetworkanalytics endpoint to get audience network insights for a business, property, or app.

GET /<ID>/adnetworkanalytics

Example GET Request

To get insights, send a GET request to the /<ID>/adnetworkanalytics endpoint with a comma-separated list of metrics and optional comma-separated list of breakdowns where <ID> is your Meta business ID, property ID, or app ID. The following example gets metrics over a single 24 hour period and limiting the results to 2 responses per metric.

Formatted for readability. Be sure to replace bold and italics placeholder values with your values.
      curl -X GET https://graph.facebook.com/v21.0/BUSINESS_ID/adnetworkanalytics
      ?metrics=["fb_ad_network_request","fb_ad_network_imp","fb_ad_network_click","fb_ad_network_revenue"]
      &breakdowns=["placement","country"]
      &since=2021-08-06
      &until=2021-08-06
      &limit=2
      

Example Response

{
  "data": [
    {
      "query_id": "531234567890123456789012345683d6",
      "results": [
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_imp",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AE"
            }
          ],
          "value": "1200"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_imp",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AU"
            }
          ],
          "value": "35"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_revenue",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AE"
            }
          ],
          "value": "21.212345"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_request",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AD"
            }
          ],
          "value": "1"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_request",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AE"
            }
          ],
          "value": "12"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_click",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AE"
            }
          ],
          "value": "1"
        },
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_click",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "CA"
            }
          ],
          "value": "2"
        }
      ],
      "omitted_results": [
        {
          "time": "2021-08-06T07:00:00+0000",
          "metric": "fb_ad_network_revenue",
          "breakdowns": [
            {
              "key": "placement",
              "value": "123456789012345"
            },
            {
              "key": "country",
              "value": "AU"
            }
          ]
        }
      ]
    }
  ],
  "paging": {
    "cursors": {
      "before": "MAZDZD",
      "after": "MQZDZD"
    },
    "next": "https://graph.facebook.com/v10.0/142440604406900/adnetworkanalytics?access_token=<ACCESS_TOKEN>&since=2021-08-06&until=2021-08-06&breakdowns=%5B%22placement%22%2C%22country%22%5D&limit=2&metrics=%5B%22fb_ad_network_request%22%2C%22fb_ad_network_imp%22%2C%22fb_ad_network_click%22%2C%22fb_ad_network_revenue%22%5D&after=MQZDZD"
  }
}

Reference

Query Parameters

ParameterDescription

aggregation_period

aggregation_period=hour|day|total


Aggregate results by day (default), hour, or total. Limitations: To aggregate results by hour you must query at least 2 days of results using since and until.

breakdowns

breakdowns=['breakdown_1', 'breakdown_2',...]


Syncronous requests have no limits on the number of breakdowns that can be included.

Breakdown typesDescription

ad_space

Breakdown by ad space

country

Breakdown by country

delivery_method

Breakdown by either standard or bidding when the metric comes from an ad served through Audience Network bidding. Only available for publishers using Monetization Manager.

fail_reason

Only available for fb_ad_network_no_fill and fb_ad_network_no_bid metrics.

placement

Breakdown by placement ID. Cannot be used with placement_name.

placement_name

Breakdown by placement ID and name. Cannot be used with placement.

platform

Breakdown by platform. ios, android, mobile_web or instant_games. Only available for publishers using Monetization Manager.

property

Breakdown by propery ID

filters

filters=[{'field':'country', 'operator':'in', 'values':['US', 'JP']}]


Further filter responses to get more specific results. The field, operator, and values key:value pairs are required. values is a comma-separated list of values. Currently only the in operator is supported.

fieldvalues

country

A comma-separated list of two letter country abbreviations

placement

Placement IDs. Limitations: REDACTED if the number of impressions is not sufficient.

delivery_method

standard or bidding

platform

Can be ios (mobile app), android (mobile app), mobile_web or instant_games.

limit

limit=500


The number of rows to return. Limitations: Syncronous requests have a maximum limit of 2,000.

metrics

Required.


metrics=['metric_1', 'metric_2',...]


At least one metric is required but there are no limits on the number of metrics that can be included in a request.

ordering_column

ordering_column=time|value


Order by the results by time or value. Defaults to time if not included.

ordering_type

ordering_column=ascending|descending


Defaults to descending if not included.

since

since=YYYY-MM-DD or since=1548880485


The starting limit of the query (always inclusive). Defaults to past 7 days if not included.

Limitations:

  • To use Unix timestamps you must query at least 1 hour.
  • You can only request up to 8 days in syncronous requests.
  • Data is only retained for 540 days. Requests for data beyond $currentDate - 539 days won't return additional data.

until

until=YYYY-MM-DD or until=1548880485+86400


The ending limit of the query (exclusive by default, inclusive for hourly aggregations)

Available Metrics

MetricDescription

fb_ad_network_bidding_bid_rate

Rate of bid responses

fb_ad_network_bidding_request

Number of bid requests

fb_ad_network_bidding_response

Number of bid responses

fb_ad_network_bidding_win_rate

Rate of auction wins by the bidder

fb_ad_network_click

Number of clicks

fb_ad_network_cpm

Effective CPM (eCPM)

fb_ad_network_ctr

Estimated click rate

fb_ad_network_fill_rate

Rate of filled ad requests

fb_ad_network_filled_request

Number of filled ad requests

fb_ad_network_imp

Number of impressions

fb_ad_network_no_bid

Count of top no response bid reasons


Available only when used as a single metric fail_reason breakdown

fb_ad_network_no_fill

Count of top no-fill reasons


Available only when used as a single metric fail_reason breakdown

fb_ad_network_request

Ad requests

fb_ad_network_revenue

Estimated revenue

fb_ad_network_show_rate

Impressions divided by Filled

Troubleshooting

Access Token Debugger

Use the Access Token Debugger to get detailed information for an access token, including permissions, validity, property access, and App ID associated with the token.

Error Messages

Error Message / IssueResolution

Expired Token

For best user experience, use Long-Lived Access Tokens

“Facebook has detected that [your app] isn't using a secure connection to transfer information error when using read_audience_network_insights scope."

Ensure that your Business has been onboarded in Monetization Manager and you have created at least one property.

"Reading insights of a Page, business, app, domain or event source group not owned by the querying user or application."

Review Business Settings to make sure that you are requesting data owned by the Business that you are querying for.

"Unsupported GET request. Object with ID X does not exist, cannot be loaded due to missing permissions, or does not support this operation. Read the Graph API documentation."

Review the property to make sure that you are requesting data for a property you own.

"The way to access reporting API v2.0 has changed. You now need to implement Facebook Login for your app to access this API. See instructions here: https://developers.facebook.com/docs/facebook-login/"

You have tried to query the Reporting API v2 with the System User token. Use Facebook Login to make queries, or revert to v1 (but you will need to implement Facebook Login anyway in the future).

"Bad arg: All applications should have a property"

Ensure that your Business has been onboarded in Monetization Manager and you have created at least one property.

""Please reduce the amount of data you're asking for, then retry your request."

  • If you are using the day or hour aggregation period, set a lower value for the limit parameter.
  • If you are using the total aggregation period, reduce the duration of the date range specified by the since/until parameters.

"You can have at most 250 queries per minute"

Reporting API V2 allows requests with multiple parameters and the use of pagination. Please look into ways of using less API requests where possible.