我想转换这个 Facebook Graph API 请求:
act_xyz/ads?fields=insights.date_preset(yesterday){ad_name,adset_name,campaign_name,account_name,account_id,impressions,inline_link_clicks,spend,ad_id},adcreatives{object_story_spec}
使用 Facebook 广告 PHP SDK。现在我有这个代码:
$account = new AdAccount('act_xyz');
$fields = array(
InsightsFields::AD_NAME,
InsightsFields::ADSET_NAME,
InsightsFields::CAMPAIGN_NAME,
InsightsFields::ACCOUNT_NAME,
InsightsFields::ACCOUNT_ID,
InsightsFields::IMPRESSIONS,
InsightsFields::INLINE_LINK_CLICKS,
InsightsFields::SPEND,
InsightsFields::AD_ID
);
$params = array(
'date_preset' => InsightsPresets::YESTERDAY
);
$account->getInsights($fields, $params);
[...]
$fields = array(
AdCreativeFields::OBJECT_STORY_SPEC
);
$account->getAdCreatives($fields);
我可以单独获取所有数据,但我想像 Graph API 一样为我的 AdAccount 上的每个广告获取 AdCreatives 和 Insights。谢谢。