[英]Facebook API Get Ad Account Ad Spend
I'm attempting to just get the spend for specific Ad Accounts from the previous day. 我正试图从前一天开始支出特定广告帐户的费用。 Whenever I send up the request: 每当我发出请求时:
$api = Api::instance();
$account = new AdAccount('act_<account_id>');
$params = array(
'level' => 'account',
'date_preset' => 'yesterday',
'fields' => ['spend', 'account_id'],
);
$insights = $account->getInsights(array(), $params);
print_r($insights);
I get a large protected object back and can't seem to find any documentation as to how to access the actual requested data. 我得到了一个大的受保护对象,似乎找不到有关如何访问实际请求的数据的任何文档。
//Get HLG Ad Spend
$account = new AdAccount('act_10153795481711178');
$params = array(
'level' => 'account',
'date_preset' => 'yesterday',
'fields' => ['spend', 'account_id']
);
$insights = $account->getInsights(array(), $params);
$hlgData = $insights->getResponse()->getContent()['data'];
if(isset($hlgData[0]))
{
$hlgSpendFB = $hlgData[0]['spend'];
}else{
$hlgSpendFB = "0";
}
Above is how I was able to get the data from the Ad Account for spend from previous day. 以上是我如何从广告帐户获取数据以进行前一天支出的信息。 After digging through the object itself I was able to find the getter functions that procured the data requested. 在深入研究对象本身之后,我能够找到用于获取所请求数据的getter函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.