简体   繁体   中英

ADFORM API PHP Metrics - NEWB Warning

I'm a newb when it comes to PHP and API's so please forgive me if I make any mistakes in terminology etc.

I'm creating an API to call Data from ADFORM reports , and have issues in selecting various metrics.

I make a POST to https://api.adform.com/v1/reportingstats/agency/reportdata

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

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

The response:

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
                                )

                        )

                )

In the response the adUniqueness = "all" which is a default however from the Adform documentation ( http://api.adform.com/help/references/buyer-solutionsc/reporting/metadata/metrics ) there are other statistics for uniqueness level.

{
  "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": ""
            }
          ]
        }
      ]
    }

How do I add the "campaignUnique" to the POST?

{
  "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"}
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM