【问题标题】:How to set time_ranges for Ad Report Stats?如何为广告报告统计设置 time_ranges?
【发布时间】:2013-11-26 23:16:22
【问题描述】:

https://developers.facebook.com/docs/reference/ads-api/adreportstats/

根据文档

time_ranges 时间戳对象数组 {time_start, time_stop} 或日期对象 {day, month, year}。

所以在 Graph API Explorer 中,我将 time_ranges 值设置为

time_ranges=[{"day_start":{"day":1,"month":11,"year":2013}},{"day_stop":{"day":10,"month":11,"year":2013}}]

这会返回一个错误

{
  "error": {
    "message": "(#100) Please set time_start and time_stop or day_start and day_stop.", 
    "type": "OAuthException", 
    "code": 100
  }
}

为简洁起见,我删除了上述 URL 的其他部分。我已经尝试使用 date_preset 值并且报告返回数据。

谢谢。

编辑:完整的 URL(没有有效的帐户 ID)

https://graph.facebook.com/act_12345/reportstats?data_columns=["account_id","account_name","campaign_id","campaign_name","impressions","clicks","spend"]&time_ranges= ["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year ':2013}}"]

【问题讨论】:

  • 当时我最终使用了带有 Unix 时间戳的 time_interval。就像graph.facebook.com/act_1234567/…{'time_start':1393142400,'time_stop':1393315200}&time_increment=1 我还没有验证在@Tommy Crush 工作之后发布的答案是否。谢谢。

标签: facebook facebook-graph-api facebook-ads-api


【解决方案1】:

奇怪的是,该示例似乎是一个字符串数组,它们是 json 对象。所以尝试改变这一行:

time_ranges=[{"day_start":{"day":1,"month":11,"year":2013}},{"day_stop":{"day":10,"month":11,"year":2013}}]

对此:

time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year':2013}}"]

【讨论】:

  • 感谢@Tommy 检查。但我仍然得到同样的错误。我已经用完整的 URL 修改了我的帖子,以防您发现其他错误。
【解决方案2】:

我有(有!)一个相同的问题。

我通过使用time_starttime_stop 而不是day_startday_stop 来解决这个问题。愚蠢,我知道……但这对我有用。

所以要获取 1 天的数据(例如 11 月 19 日):

 &time_ranges=["{'time_start': '2013-11-19','time_stop':'2013-11-20'}"]

【讨论】:

    【解决方案3】:

    我有同样的问题,尝试使用:

    time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}, 'day_stop':{'day':10,'month':11,'year':2013}}"]
    

    代替:

    time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year':2013}}"]
    

    完整网址:

    https://graph.facebook.com/act_12345/reportstats?data_columns=["account_id","account_name","campaign_id","campaign_name","impressions","clicks","spend"]&time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}, 'day_stop':{'day':10,'month':11,'year':2013}}"]
    

    我在https://developers.facebook.com/x/bugs/1423346704577387/打开了一个文档问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多