加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何使用fb api计算估计的每日覆盖率

发布时间:2020-12-13 16:55:20 所属栏目:PHP教程 来源:网络整理
导读:我想用fb api显示每日估计的覆盖面. 我试过下面的代码: – $ch = curl_init(); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10); curl_setopt($ch,CURLOPT_TIMEOUT,60); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_USERAGENT,'fa
我想用fb api显示每日估计的覆盖面.

我试过下面的代码: –

$ch = curl_init();
   curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
   curl_setopt($ch,CURLOPT_TIMEOUT,60);
   curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
   curl_setopt($ch,CURLOPT_USERAGENT,'facebook');

$url_en = urlencode("{'geo_locations':{'countries': ['US'],},'age_min':20,'age_max':24}");


   curl_setopt($ch,CURLOPT_URL,"https://graph.facebook.com/v2.2/act_1375199556085956/reachestimate?access_token=ACCESS TOKEN&targeting_spec=".$url_en);

   curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
   curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);
   curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
   curl_setopt($ch,CURLOPT_HEADER,0);
   //curl_setopt($ch,1);

   $data = curl_exec($ch);

但获得以下响应数据: –

"data": {
      "users": 14600000,"bid_estimations": [
         {
            "unsupported": false,"location": 3,"cpa_min": 79,"cpa_median": 145,"cpa_max": 195,"cpc_min": 45,"cpc_median": 70,"cpc_max": 87,"cpm_min": 8,"cpm_median": 20,"cpm_max": 27
         }
      ],"estimate_ready": true
   }
}

但是,我想要的结果如下:

请帮我解决一下这个.

解决方法

在v2.9中添加

/<AD_ACCOUNT>/delivery_estimate

要么

/<AD_SET>/delivery_estimate

参考:https://developers.facebook.com/docs/marketing-api/buying-api/targeting/v2.9

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读