英文:
How to retrieve insights API for ad in day-granularity on Facebook?
问题
如何从Facebook API以日粒度检索见解数据。
这是我使用的请求:
1234548/insights?fields=ad_id,impressions,account_id,created_time,adset_id,campaign_id,clicks,conversions&time_range={'since':'2023-01-01','until':'2023-05-20'}
响应:
"data": [
{
"ad_id": "xxxxxxxx",
"impressions": "54367",
"account_id": "xxxxxxxx",
"created_time": "2023-05-17",
"adset_id": "xxxxxxxxxxx",
"campaign_id": "xxxxxxxxxx",
"clicks": "853",
"date_start": "2023-01-01",
"date_stop": "2023-05-20"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MAZDZD"
}
}
}
我选择了一个在5月17日创建的广告,并期望以1天的粒度收到JSON数据,但如您所见,点击等指标被汇总了。
有任何想法吗?
谢谢。
英文:
How to retrieve the insights data in day-granularity from Facebook API.
This is the request I use:
1234548/insights?fields=ad_id,impressions,account_id,created_time,adset_id,campaign_id,clicks,conversions&time_range={'since':'2023-01-01','until':'2023-05-20'}
The response:
  "data": [
    {
      "ad_id": "xxxxxxxx",
      "impressions": "54367",
      "account_id": "xxxxxxxx",
      "created_time": "2023-05-17",
      "adset_id": "xxxxxxxxxxx",
      "campaign_id": "xxxxxxxxxx",
      "clicks": "853",
      "date_start": "2023-01-01",
      "date_stop": "2023-05-20"
    }
  ],
  "paging": {
    "cursors": {
      "before": "MAZDZD",
      "after": "MAZDZD"
    }
  }
}
I picked an ad that was created on the 17.5, and expected to receive JSON with the data for a 1-day granularity, but received the metrics summarized as you can see with the clicks.
Any ideas?
Thanks,
答案1
得分: 0
你需要通过在API请求中添加time_increment
(enum{monthly, all_days} or integer
)参数,将其值设为1
以获取每日数据。尝试以下代码:
1234548/insights?fields=ad_id,impressions,account_id,created_time,adset_id,campaign_id,clicks,conversions&time_range={'since':'2023-01-01','until':'2023-05-20'}&time_increment=1
你应该在响应中收到每日粒度的数据。查看Meta Dev上的time_increment截图和此处的网站以获得一些有趣的阅读。
英文:
You need to modify your API request by adding the time_increment
(enum{monthly, all_days} or integer
) parameter with a value of 1
for daily. Try;
1234548/insights?fields=ad_id,impressions,account_id,created_time,adset_id,campaign_id,clicks,conversions&time_range={'since':'2023-01-01','until':'2023-05-20'}&time_increment=1
You should receive daily granularity data in the response. Screenshot of time_increment on Meta Dev and website ref for some fun reading.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论