Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

facebook - Return value of ads insights in graph api

I currently don't have any campaigns that have been launched with ACTIVE status in Facebook so whenever I try to query the insights endpoint I receive an empty array of data[] which doesn't allow me to do much.

I would like to know how a response would look for an adset that has been launched with an active status and actually contains insights' data, using a query like this one:

GET graph.facebook.com/v8.0/{adset_id}/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm&access_token={access_token}

I think is that it might look something like this, but I would like to get the exact response structure:

{
    "data": [
        {
            "name": "metric_name",
            "values": [
                {
                    "end_time": "some_date_string",
                    "value": numeric_string,
                }
            ]
        }
   ]
}
question from:https://stackoverflow.com/questions/65929204/return-value-of-ads-insights-in-graph-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've made <adset_id>/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm

Example output:

{
  "data": [
    {
      "reach": "12739",
      "unique_ctr": "1.420834",
      "cpm": "13.740269",
      "date_start": "2020-02-25",
      "date_stop": "2021-01-28"
    }
  ],
  "paging": {
    "cursors": {
      "before": "MAZDZD",
      "after": "MAZDZD"
    }
  }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...