Marketing API Version

Ads Pixel Stats

Reading

Stats data for this pixel

Graph API Explorer
GET /v2.10/{ads-pixel-id}/stats HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{ads-pixel-id}/stats'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{ads-pixel-id}/stats",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ads-pixel-id}/stats",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{ads-pixel-id}/stats"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
  • ads_read
Page management Apps
No data
Other Apps
No data

Parameters

NameDescription
aggregation
enum{browser_type, custom_data_field, device_os, device_type, event, host, pixel_fire, url}

The aggregation to use for the stats.
browser_type: Get the number of pixel fires per browser type, broken down by hour.
custom_data_field: Get the number of pixel fires for the top 100 custom data fields of an event broken down by hour.
device_os: Get the number of pixel fires per mobile device OS, broken down by hour.
device_type: Get the number of pixel fires per mobile device type, broken down by hour.
event: Get the number of pixel fires for the top 100 events broken down by hour.
host: Get the number of pixel fires for the top 10,000 hosts broken down by hour.
url: Get the number of pixel fires for the top 10,000 URLs broken down by hour. Please note that query parameters are stripped from the URLs.
pii_keys: Get the number of pixel fires by PII keys by hour.
pii_lift: Get the number of pixel fires matched by PII by hour.
pixel_fire: Get the number of pixel fires by hour.

end_time
datetime

The end time of the stats, in the format of Unix or ISO 8601 timestamp. You can get the data up to seven days from the request time.

event
string

Specify which event to aggregate on, when the aggregation is custom_data_field

start_time
datetime

The stat time of the stats, in the format of Unix or ISO 8601 timestamp.

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of AdsPixelStatsResult nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter
294Managing advertisements requires an access token with the extended permission for ads_management
275Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects.
272This Ads API call requires the user to be admin of the application
274The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API

Creating

You can't perform this operation on this endpoint.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.