Facebook Marketing API Get Campaigns per date - facebook

I have created an application requesting from facebook's Marketing API, to return all my ad accounts, and from all my ad accounts all my ad campaigns, and from all my campaigns, get insights for a specific date(or date range).
Now because my campaigns are too many and I can't make a request for every campaign in a account(even if I wanted the facebook's throttling mechanism kicks in) I am trying to find a way to get only the campaigns that were active or had data on my specific date(date range).
I added the 'time_range' parameter as the link below (Api manual) describes:
https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/
time_range format I use: &time_range={'since':'2016-06-13','until':'2016-06-13'}
But I get exactly the same result. All my campaigns if I set the 'limit' parameter to a high value or 25 campaigns if I don't use a the 'limit' parameter(default paging).
Anyone had any issues with the api before? Or any suggestions?

It is likely that you are not using the time_range param correctly. Check out this answer: time range filter on ads endpoint (Facebook API)

Related

How to get Authenticated user's Google Ad Account ID using Google Ads API v0 using a REST API?

I have been trying to figure out after referring to their official documentation (Google Ads API Document) which is not clear enough
Here is what I have tried till now.
I have created an app where users can log in with their Google Ad words account. I need to fetch their Ad performance reports via REST API.
To make an API request to fetch performance reports, we need the Google Ad Words Account ID of the authenticated user. Currently, as I am testing it with my personal account, I can login to my Ad words Console and get the Ad Words Account ID. But, how do I fetch the Ad Words Account ID dynamically for other users who authenticate via my App?
I tried looking for a way in their official documentation. But I couldn't figure out.
Could someone help me with the REST API URL which needs to be called to fetch the authenticated user's Ad words Account ID.
In addition to previous answer, I guess this is what you are looking for:
https://developers.google.com/adwords/api/docs/guides/first-api-call#create_test_accounts
It explains how to setup Google Ad Words API and get your ID.
According to the documentation here Account overview, you need to list the customers to get the ID. For each user that logs in as long as they do not have access to multiple accounts you should get a single customer and their ID.
CustomerService
CustomerService provides information about your accounts. It has a
getCustomers() method that takes no arguments and returns a list of
Customer objects containing fields such as customerId, currencyCode,
and dateTimeZone. CustomerService also has a mutate() method that can
be used to update various attributes of a customer, including the
autoTaggingEnabled and conversionTrackingSetting fields.
If no clientCustomerId is specified in a request, the response will
contain multiple entries if more than one account is directly
accessible by the authenticated account.

Get results for specific facebook marketing campaigns objectives

Each Facebook ad campaign has an objective, such as LINK_CLICKS or CONVERSIONS.
In Ad Manager, one can see the performance of each of their ad campaigns. There is a column called "results" that has the number of objective-specific conversions for that campaign. So for example, if the objective is PAGE_LIKES then results would show the number of page likes resulting from the campaign, but if the objective was LINK_CLICKS then results would show website clicks.
My question is: Is there something in the Insights API that equates to the results column in Ad Manager? Part of the reason I ask is for ease and consistency, but also some of the objectives are ambiguous, e.g. BRAND_AWARENESS.
No, I haven't been able to easily replicate the results and cost per result columns from the ad manager with an API call.
First you can check the URL when in the ad manager to see which columns are selected by looking at the GET parameter columns:
https://business.facebook.com/ads/manage/powereditor/manage/ads?act=...&business_id=..&columns=name%2Cerrors%2Cdelivery%2Cresults%2Creach%2Cimpressions%2Ccost_per_result&...
Decoding this gives the following fields:
columns=name,errors,delivery,results,reach,impressions,cost_per_result
Now it looks like we could simply use the result and cost_per_result fields, but that gives an error:
(#100) results, cost_per_result are not valid for fields param.
This is expected as the API document doesn't specify results and cost_per_result as valid fields.
Now when in the ad manager we can also see the API calls use the network tab of developer tools to see it making API calls to retrieve data. This shows us the result and cost_per_result fields being used. You can actually copy the request URl and see it working... somehow..
Trying to recreate this API call in the Graph API Explorer only worked for me when I copied the access token from the previous call. This makes me feel that the business manager has a special access token.

Cannot retrieve the reach estimate for some Facebook ads (from the API)

The API lacks some clear explanations on retrieving the reachestimate for either an ad account or an ad. I have made sure that:
I am an admin/ or added to a Facebook app
I have a paid advertising campaign
The adaccount ID is added in the Settings Advanced panel of the Developer App page
I've been trying to:
In Graph API Explorer, retrieve the data by query expansion: me?fields=adaccounts{campaigns{adsets{ads{reachestimate}}}}. However, I always get one of the following (randomly):
Still in the explorer, retrieve it by direct access: act_{adaccount_id}/reachestimate I get this, even if I am 100% sure the ad account is added in the Advanced Settings panel:
Both of 1 and 2 in the iOS project. I get this: com.facebook.sdk.core error 8
Test it by curl with the example from here. I get this (the same with the one from point 2): The ad account is not enabled for usage in Ads API.
Just as a further note, for point 1 that's not the whole query, but I didn't write the adjacent fields because they would've been redundant for the purpose of this question.
I simply need to retrieve the ad accounts, the campaigns, the ad sets and the reach estimate simultaneously in the same query. It seems like a dead spot for me. Do you have any suggestions? Can you show me a Graph API explorer working example? Or, if what I'm asking is impossible, can you simply show some code that works?
Are you app and ad account owned by the same person?
Facebook Ads API has tiered access. https://developers.facebook.com/docs/marketing-api/access
A newly registered app is in Development Tier and can only access the user's own ad accounts. You need to make some API calls on your own ad account for testing in order to get promoted to Basic Tier and manage other people's ad account.
Apparently, I got:
Please reduce the amount of data you're asking for, then retry your request.
Because the query was to broad. Those 'adjacent' fields actually triggered a massive query, so the solution was to either:
Put a limit(1) on the campaigns.
Individually retrieve the reachestimate for each adset.
I chose the latter because it suited my needs, but it's up to you which solution works better.

Testing Pagination of Facebook Graph API

I need to test that I can fetch subsequent pages of reviews from facebooks graph API.
The issue I have is that an account can only review a page once, and pagination doesn't kick in til there are over 100 reviews.
Do I really need to create 101 user accounts and have each one of them manually submit a review, just so I can be sure that when real companies use the software I'll be able to fetch the paginated results correctly?
Is there an alternative?
The issue I have is that an account can only review a page once, and pagination doesn't kick in til there are over 100 reviews.
That’s just the default limit for that endpoint - but you can specify a different limit in your initial query (simply via the parameter of the same name, /page/ratings?limit=3)
The prev/next links generated by the API then also use that limit value.
That way, you should be able to test pagination on smaller datasets as well.

Facebook API Group /feed limited to 10 items no matter the parameters

When I query my owned secret Facebook group feed with a correct token and a limit parameter, say /123456384920/feed?limit=50, the Graph API only return 10 items and the paging doesn't work: the next "page" is returning no data (data: []).
It has worked several days ago, and my app isn't rate limited. The group has more than 10 items of course. I can't guess what is the problem.
Can anybody confirm it?
Is there a more precise changelog for the Graph API (fixes & stuff) other than the version upgrade changelog?