AdsPixelStats
GET /v21.0/{ads-pixel-id}/stats HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{ads-pixel-id}/stats',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* 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();
/* 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
}];
Parameter | Description |
---|---|
aggregation enum{browser_type, custom_data_field, device_os, device_type, event, host, match_keys, had_pii, pixel_fire, event_detection_method, url, event_value_count, url_by_rule, event_total_counts, event_source, event_processing_results} | Default value: event The aggregation to use for the stats. Default: |
end_time datetime/timestamp | Default value: 1732216501 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 |
event_source string | Specify WEB_ONLY or SERVER_ONLY to filter the pixel events and stats |
start_time datetime/timestamp | The start time of the stats, in the format of Unix or ISO 8601 timestamp. |
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {} }
data
paging
Error | Description |
---|---|
100 | Invalid parameter |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
190 | Invalid OAuth 2.0 Access Token |
80004 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management. |
200 | Permissions error |