ADFORM API PHP指标 - NEWB警告

时间:2018-03-06 16:02:22

标签: php json api

对于PHP和API,我是一个新手,所以如果我在术语等方面犯了任何错误,请原谅我。

我正在创建一个API来调用来自ADFORM reports的数据,并且在选择各种指标时遇到问题。

我向https://api.adform.com/v1/reportingstats/agency/reportdata

发帖
{
  "dimensions": [
    "client",
    "campaign"
  ],
  "metrics": [
                "clicks",
                "impressions"

  ],
  "filter": {
    "date": "campaignStartToEnd"
  }
}

回应:

Array
(
    [reportData] => Array
        (
            [columnHeaders] => Array
                (
                    [0] => client
                    [1] => campaign
                    [2] => clicks
                    [3] => impressions
                )

            [columns] => Array
                (
                    [0] => Array
                        (
                            [key] => client
                        )

                    [1] => Array
                        (
                            [key] => campaign
                        )

                    [2] => Array
                        (
                            [key] => clicks
                            [specs] => Array
                                (
                                    [dataSource] => adform
                                    [adUniqueness] => all
                                )

                        )


                    [3] => Array
                        (
                            [key] => impressions
                            [specs] => Array
                                (
                                    [dataSource] => adform
                                    [adUniqueness] => all
                                )

                        )

                )

在回复中,adUniqueness =“all”是默认值,但是从Adform文档(http://api.adform.com/help/references/buyer-solutionsc/reporting/metadata/metrics)中还有其他唯一性级别的统计信息。

{
  "metricsMetadata": [
    {
      "key": "clicks",
      "category": "Delivery",
      "displayName": "Clicks",
      "displayFormat": "n0",
      "description": "This metric shows the number of clicks for the selected dimension. A click occurs when a user interacts with the advertisement by engaging a mouse button (usually the left) while the mouse pointer is hovering over the advertisement.",
      "specsMetadata": [
        {
          "key": "adUniqueness",
          "displayName": "Uniqueness",
          "description": "Display statistics for selected uniqueness level",
          "specValuesMetadata": [
            {
              "key": "all",
              "displayName": "All",
              "isDefault": true,
              "description": ""
            },
            {
              "key": "campaignUnique",
              "displayName": "Campaign unique",
              "isDefault": false,
              "description": ""
            }
          ]
        }
      ]
    }

如何将"campaignUnique"添加到POST?

1 个答案:

答案 0 :(得分:0)

{
  "dimensions": [
    "client",
    "campaign"
  ],
  "metrics": [
    {
      "metric": "impressions",
      "specs": {
        "adUniqueness": "campaignUnique"
      }
    },
{
      "metric": "impressions",
      "specs": {
        "adUniqueness": "all"
      }
    },
    {
      "metric": "clicks",
      "specs": {
        "adUniqueness": "campaignUnique"
      }
      },
 {
      "metric": "clicks",
      "specs": {
        "adUniqueness": "all"
      }
    }
  ],
  "filter": {
    "date": {"from":"2018-01-01", "to":"2018-02-20"}
  }
}