Facebook ads insights for inactive/paused campaign - facebook

I am getting blank result when I tried to retrieve information regarding inactive campaign statistics using Graph API explorer.
e.g.
/v2.10/xxxxxxxxxx/insights?level=campaign&filtering=[{'field':'campaign.delivery_info','operator':'IN','value':['inactive']}]&date_preset=last_month&fields=impressions,ctr,cpc,clicks,campaign_name,call_to_action_clicks,total_action_value,spend
Result:
{
  "data": [  ]
}
Regards
Shah

Related

Facebook graph api me/events returns blank

I'm using the Graph API Explorer and have given permissions for user_posts, user_likes & user_events.
me/posts and me/likes return non-empty data, but me/events returns this:
{
"data": [
]
}
I do have ongoing and upcoming events (interested) and they are visible on my Facebook profile.
Any idea what's going wrong? Or is it a Facebook bug?
https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes
Testing of our more robust process starts today and the new process
should resume in a few weeks, but apps currently accessing Events and
Groups APIs will lose access today.
This may also be interesting for you: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#events-4-4

Getting Facebook Page Posts by Date period using Graph API

I want to get page posts by filtering date using Facebook Graph API, but it lets me filter only one week. For example, if today is 2017-05-01, I can get page posts between 2017-04-23 -> 2017-05-01 but I can get page posts between 2017-01-01 to 2017-04-01. Moreover,I've tried using :
me?fields=feed.since(2017-01-01).until(2017-04-01)
and the result I've got is
{
"id": "XXXXXXXXXXX"
}
Could you please show me how to get past page posts by using date period? Thanks!
Use a User Token, and grants the 'user_posts' permission.
You must change the call to add explicitly the fields that you want to retrieve. Ex. "me/feed?fields=message,description...."

Facebook get/querying all wall posts (access tokens return completely different values)

I've been trying to query what people have posted on my wall as a quick metric of closeness. I've tried both FQL and the Graph API to make these queries without a problem...
FQL:
SELECT actor_id FROM stream WHERE source_id = me() AND message != "" LIMIT 50
Graph:
FB.api('/me/feed?fields=from&limit=50', function(feedresponse) { //do stuff });
Testing these in the Graph Explorer when the application is set to "Graph API Explorer" returns the values I want - my own and other's posts on my wall.
However when the application is changed to my own application, "Fingerprint", the values include my likes, my recent friendship notifications, etc... information I don't want returned and that completely pollutes the query.
I've still gotten the correct results by passing the Graph API Access Token like so:
var access_token = "CAACEdEose0cBALLruchzIKJ1ewgvcjpPJmo1amJwbMHGYyuk544om8hDILt0ZBXiUAriiNI7VY2g1OOwlEgV4bVyCWZACOf2djD1rYBTIwxBnmseNHUm6qybvus23F4AShctQl3wu0rpPS5ZBh68ypVoDMgyyXEGnu6uXBbzOJ7Tx43m2xHsseo1oiU7A80oelxphhidgZDZD";
FB.api('/me/feed?fields=from&limit=50', { access_token : access_token}, ...
Though it works - it definitely doesn't seem like the right way. Can anyone explain why the results are different and how I can get my feed without the other bullshit FB sends me when I'm using the User Access Token with my App.

Get actual reach for several ads using Facebook Ads API

I'm looking for a way to get the overall reach for several ads on facebook (using facebook ads api). This reach should not be the sum of all ads reach, because if the same user saw 2 different ads, it should count him as 1 and not as 2.
It should not be a regular sum, but the number of unique users who were exposed to all or some of these ads.
Assuming you have a valid access token for the user that created those ads, you should be able to do something like the following:
HTTP GET https://graph.facebook.com/act_ACCOUNTID/reportstats?date_preset=yesterday&data_columns=['adgroup_id','reach']
Then in the response of the call, you should see something like
{ data: [ { adgroup_id: 1, reach: 100 } ] }
See https://developers.facebook.com/docs/reference/ads-api/adreportstats/ for the skinny on the ad report stats API.

How to get all facebook pages id associated with my account?

I want to get the statistics of all the pages associated with my account on facebook, i have the code to get the statistics of a page, i just want to get the page id of all the pages associated with my account, how can i do this?
Please help.
Thanks.
You'll need to request the manage_pages permission (more details here), once you have the aquired the permission, all you have to do is make a request to :
https://graph.facebook.com/YOUR_FACEBOOK_ID/accounts.
The return value will be a JSON with all the pages/applications that are associated with your account.
You can also use this great tool that facebook provides - The Graph API Explorer (/me/accounts) to explore what other information you can retrieve without having to write a single line of code :P very useful.
FB.api('/me/accounts', function(response) {
for (id in response.data)
{
page = data[id];
page.id;
page.name;
}
});
You can use Javascript API to do this, read more :http://developers.facebook.com/docs/reference/javascript/