如何在Facebook上以每天的粒度检索广告洞察API?

huangapple go评论56阅读模式
英文:

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_incrementenum{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.

huangapple
  • 本文由 发表于 2023年5月21日 19:30:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76299688.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定