Comments (13)
Hi arass,
Looks like you've got throttled for making too many api calls within short time. If you make tens of API calls within a few seconds, that could happen.
Suggested solution:
- Use AdAccount/Campaign/AdSet level insights and set 'level' to 'ad', so that you can get the insights of all ads in one HTTP request, instead of making one api call for each of the ads.
- Apply for higher access tier if eligible. This will increase your rate limit. You can see more details on https://developers.facebook.com/docs/marketing-api/access.
from facebook-java-business-sdk.
Was looking more into it. It seems that the cause is that even though I'm only making a few calls (<25) - the "cost" of these calls combined is higher than allowed?
So FB built an API that's useless to access Insights?
I can create a server/proxy farm that would cycle IPs, but was hoping someone had a better solution.
We can't wait hours to load a few stats on ads.
Seems like an epic fail on the part of FB.
Any suggestions?
from facebook-java-business-sdk.
from facebook-java-business-sdk.
Tried going through adsets before, but got killed on too many requests there also.
Went to the batch mode, for now, while we test (at least gets me a full set of insights). But your solution2 seems like the ultimate answer and is worth perusing. Thanks a lot! This makes more sense than encountering such a tiny rate limit and trying to work with it.
Much appreciated!
from facebook-java-business-sdk.
Hi arass,
Looks like you've got throttled for making too many api calls within short time. If you make tens of API calls within a few seconds, that could happen.
Suggested solution:
- Use AdAccount/Campaign/AdSet level insights and set 'level' to 'ad', so that you can get the insights of all ads in one HTTP request, instead of making one api call for each of the ads.
- Apply for higher access tier if eligible. This will increase your rate limit. You can see more details on https://developers.facebook.com/docs/marketing-api/access.
Yes he is right. accessing edges like adsets and ads directly from Ad_accounts node is better than accessing them individually . It would require less api requests.
from facebook-java-business-sdk.
Accessing edges like adsets and ads directly from Ad_accounts node is better than accessing them individually . It would require less api requests.
from facebook-java-business-sdk.
Just adding:
You can use expand fields
https://graph.facebook.com/v9.0/<ACCOUNT_ID>/ads?fields=name,account_id,id,insights.date_preset(yesterday){reach,impressions,clicks,cpc,cpm,cpp,ctr}
or
Insights api with account node with level
https://graph.facebook.com/v9.0/<ACCOUNT_ID>/insights?date_preset=yesterday&level=ad
This looks like a neat approach to me. I welcome suggestions!
from facebook-java-business-sdk.
How can I pass insights time_range? I have tried to pass this parameter but it does not work.
from facebook-java-business-sdk.
How can I pass insights time_range? I have tried to pass this parameter but it does not work.
in json:
params = {other params,
'time_range': '{"since":"yyyy-mm-dd","until":"yyyy-mm-dd"}'
}
url param:
&time_range={"since":"yyyy-mm-dd","until":"yyyy-mm-dd"}
from facebook-java-business-sdk.
Hello Andrew,
I want to pass multiple params, I have tried like this: insights(time_range={"since":"2021-07-14","until":"2021-07-14"},action_attribution_windows=['1d_click','1d_view','7d_view','7d_click']) but it's not work.
I am only able to pass one params at a time like this: insights.time_range({"since":"2021-07-14","until":"2021-07-14"}){reach,impressions,clicks,cpc,cpm,cpp,ctr}
Can you please help me with how can I pass multiple params?
I want to pass time_range and action_attribution_windows.
Thanks!
from facebook-java-business-sdk.
@mohitg8a Not sure posting a question unrelated to the closed issue is the right place for your answers. For insights, consider using the inner classes on the top-level class representing the level of insights you want to fetch (Campaign, AdAccount, etc). Those inner classes all say APIRequestGetInsights
or APIRequestGetInsightsAsync
. Pick whether you want to do a synchronous or asynchronous call. In my case, I need insights at the Ad Account level, so I use AdAccount.APIRequestGetInsights. If you look at those classes you'll see a bunch of setters which allow you to pass all of your various parameters before you call the .execute() on the sync class or the AdReportRun class for the async call. I initiate my own custom value object facebookAdsInsightsRequest
(this is just a POJO I wrote that has all of the values in fields with getters/setters on them):
FacebookAdsInsightsRequest facebookAdsInsightsRequest = new FacebookAdsInsightsRequest();
facebookAdsInsightsRequest.setTimeRangeFormatted(startDate, endDate);
facebookAdsInsightsRequest.set...
Then I can pass these fields into each of the setters on the APIRequestGetInsights class (this example is used to get all the campaigns that have some activity within the start and end date range for a given Ad Account):
AdAccount.APIRequestGetInsights activeCampaigns = new AdAccount.APIRequestGetInsights(adAccountId, context);
APINodeList<AdsInsights> adsInsights;
try {
activeCampaigns.setParam("level", facebookAdsInsightsRequest.getLevel())
.setParam("time_range", facebookAdsInsightsRequest.getTimeRangeFormatted())
.setParam("time_increment", facebookAdsInsightsRequest.getTimeIncrement())
.setParam("filtering", "[" + facebookAdsInsightsRequest.getCampaignFilterJson() + "]")
activeCampaigns.setFields("campaign_id");
adsInsights = activeCampaigns.execute().withAutoPaginationIterator(true);
List<String> innerCount = new ArrayList<>();
for (AdsInsights adsInsight : adsInsights) {
String campaignId = adsInsight.getFieldCampaignId();
if (campaignId != null) {
campaignIds.add(campaignId);
log.debug("Campaign ID {} has activity!", campaignId);
innerCount.add(campaignId);
}
}
} catch (APIException e) {
//do something with your exception here
}
from facebook-java-business-sdk.
Thanks, it's really helpful for me.
Thank you again.
from facebook-java-business-sdk.
Hello Guys,
how can have a similar ad creative showing that they are being used in multiple ads?
We are building an internal reporting system for creative ads reporting. And we would like to know how can have the similar ad creative showing that they are being used in multiple ads similar to what FB does: https://prnt.sc/1qh0ezk
from facebook-java-business-sdk.
Related Issues (20)
- adSet/reach-estimate does not exist in SDK HOT 1
- AdsInsights gives json parse error when fetching breakdown link_url_asset HOT 5
- Application does not have permission for this action, Please retry this action in a few minutes
- Futures.addCallback is deprecated HOT 3
- Create adset failed
- Create adset failed
- Add `depends_on` support for Batch Request HOT 1
- Async Insights - Exception while parsing image_asset field HOT 3
- lead fetch fail
- Missing `targeting_automation` field in Targeting HOT 2
- AdCreative with `asset_feed_spec` is not creating the Ad with Website destination HOT 1
- not compatible with latest guava HOT 1
- Why the `VALUE_MAXIMUM ` has been replaced with `VALUE_LIFETIME` in AdsInsights.EnumDatePreset in v19.0.1? HOT 5
- There is no Summary attribute on Insights and Campaigns
- When can we expect v20 release for java sdk HOT 1
- https://graph.facebook.com/ahmedvedohyperdjtracks/get
- Facebook Java Business SDK v20 jar is not available
- ArrayIndexOutOfBoundsException on invalid postal code
- Not able to get all conversations from instagram
- Accessing Business User Insights for Multiple Users Using the Instagram API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-java-business-sdk.