可以在Facebook Ads API中指定具有洞察力的date_preset吗? [英] Possible to specify date_preset with insights edge in Facebook Ads API?
问题描述
对于营销API,我知道我可以拨打一个电话来从某个帐户中检索所有的广告,以及他们的见解,但是我可以为同一个电话中的见解边界指定date_preset ?
For the Marketing API, I know that I'm able to make one call to retrieve all of the adsets from a certain account along with their insights, but am I able to specify the date_preset for the insights edge in that same call?
例如,下面给出了我一生的洞察统计数据:
For example, the following gives me lifetime insights stats:
/v2.4/ {accountID} / adcampaigns?fields = insights
/v2.4/{accountID}/adcampaigns?fields=insights
要清楚 - 我知道这可以通过为每个广告设置ID单独调用来检索(我知道我可以指定date_preset);相反,我想通过一个呼叫来完成,我可以一次收到广泛的列表和他们的见解细节。
推荐答案
可以使用查询扩展,但是您可能不应该这样做。
Yes this is possible using query expansion, however you probably should not do it in this anyway.
使用查询扩展导致在一个HTTP调用中执行的多个请求,在这种情况下,可以获得所有广告,然后 N
请求,其中 N
是返回的广告数量。这将反过来影响您的速率限制。
Using query expansion results in multiple requests being executed in one HTTP call, in this case one to get all the adcampaigns, and then N
requests where N
is the number of adcampaigns returned. This will in turn affect your rate limiting.
为所有广告系列(广告集)请求所有见解的最有效方式是在帐户级请求他们,指定汇总级别:
The most efficient way to request all insights for all adcampaigns (ad sets) is instead to request them at the account level, specifying aggregation level:
/v2.4/act_{ADACCOUNT_ID}/insights?date_preset=last_7_days&level=campaign
这只需要一个请求,或者要检索总页数的请求数。
This requires just 1 request, or the number of requests to retrieve the total number of pages.
如果您真的想通过查询扩展来实现此目的,您可以执行以下操作:例如:
If you really want to achieve this with query expansion, you can do the following for example:
/v2.4/act_{ADACCOUNT_ID}/adcampaigns?fields=insights.date_preset(last_30_days).time_increment(all_days)
您可以查看通常是 param_name = param_value
形式的查询参数的参数参数现在为 param_name(param_value)
。
You can see the parameters to insights that would normally be query parameters of the form param_name=param_value
are now in the form of param_name(param_value)
.
这篇关于可以在Facebook Ads API中指定具有洞察力的date_preset吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!