如何使用FB API计算预计的每日到达量 [英] How to calculate Estimated Daily Reach using fb api

查看:141
本文介绍了如何使用FB API计算预计的每日到达量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用fb api显示每日的预计覆盖率.

I want to show the daily estimated reach using 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, CURLOPT_RETURNTRANSFER, 1);

   $data = curl_exec($ch);

但是在下面获得响应数据:-

But getting the response data below :-

"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
   }
}

但是,我想要这样的结果:

BUT, I want result like:

请帮助我.

推荐答案

在v2.9中添加

/<AD_ACCOUNT>/delivery_estimate

/<AD_SET>/delivery_estimate

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

这篇关于如何使用FB API计算预计的每日到达量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆