我想获得公司所有广告的公司统计信息吗?
我现在正在使用faceebok php sdk帮助获取有关公司的统计信息,但没有广告。
当前代码:
def add_brackets(string):
_character, _index = None, 0
_return_string = ''
for i, c in enumerate(string+ ' '):
if _character is None or _character != c :
if len(string[_index:i])>1:
_return_string+='(' + string[_index: i] + ')'
else:
_return_string+=string[_index: i]
_character, _index = c, i
return _return_string
答案 0 :(得分:0)
$params = [
AdsInsightsFields::IMPRESSIONS,
AdsInsightsFields::INLINE_LINK_CLICKS,
AdsInsightsFields::SPEND,
AdsInsightsFields::CLICKS,
AdsInsightsFields::IMPRESSIONS,
AdsInsightsFields::REACH,
AdsInsightsFields::GENDER_TARGETING,
AdsInsightsFields::ADSET_ID
];
//dd($params);
$cursor = $this->Entity->getInsights($params, [
'end_time' => (new \DateTime('now'))->getTimestamp(),
'level' => 'adset', // adset(groups ads) or ad(ad statistics)
''
]);
$insights = [];
foreach($cursor->getObjects() as $insight) {
// dd($insight->getData());
$insights[] = array_only($insight->getData($params), $params);
}