Spend from Ads API and UI do not match

restapi
ads

#1

Account ID : 18ce547jz5z
async stats Job ID: 823960919537422337
campaigns having discrepancy: [“60skd”, “61zew”, “67qxe”, “6bnnf”, “6e4z9”, “6ee4v”, “6ggmf”, “6jxpd”, “6kj0x”, “6taw7”, “715mu”, “715mw”, “5cybg”]

Discrepancy amount : $229

Here is the screenshot

Here is my API CALL:
resource_url : "/1/stats/jobs/accounts/18ce547jz5z"
method: post
params: {:entity_ids=>“6ee4v,715mu,715mw,6ggmf,6bnnf,61zew,6e4z9,6kj0x,6taw7,67qxe,60skd,6jxpd,5cybg”, :entity=>“CAMPAIGN”, :end_time=>“2017-01-21T08:00:00Z”, :granularity=>“DAY”, :metric_groups=>“BILLING,ENGAGEMENT,MOBILE_CONVERSION”, :placement=>“ALL_ON_TWITTER”, :start_time=>“2017-01-20T08:00:00Z”}

Using twitter-ads gem:
response = TwitterAds::Request.new(client, :post, resource, params: params).perform

After that I pinged the URL to get the spend after Job status was successful from the above mentioned JOB ID.

Can someone please help me?


#2

Thanks for the question, @kamalptw.

This is likely due to the fact that requests are only being made to placement=ALL_ON_TWITTER. You also have to request data for placement=PUBLISHER_NETWORK. For example, for campaign 60skd (10114717), where you’re seeing a total of $35.887983, you should make the following requests:

$ twurl -H ads-api.twitter.com "/1/stats/accounts/18ce547jz5z?start_time=2017-01-20&end_time=2017-01-21&entity=CAMPAIGN&entity_ids=60skd&metric_groups=BILLING&granularity=TOTAL&placement=ALL_ON_TWITTER" | jq
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "60skd",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "billed_charge_local_micro": [
              34300000
            ],
            "billed_engagements": [
              18
            ]
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-01-20T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "60skd"
      ],
      "end_time": "2017-01-21T08:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "TOTAL",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "BILLING"
      ]
    }
  }
}
$ twurl -H ads-api.twitter.com "/1/stats/accounts/18ce547jz5z?start_time=2017-01-20&end_time=2017-01-21&entity=CAMPAIGN&entity_ids=60skd&metric_groups=BILLING&granularity=TOTAL&placement=PUBLISHER_NETWORK" | jq
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "60skd",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "billed_charge_local_micro": [
              1587983
            ],
            "billed_engagements": [
              1
            ]
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-01-20T08:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "60skd"
      ],
      "end_time": "2017-01-21T08:00:00Z",
      "country": null,
      "placement": "PUBLISHER_NETWORK",
      "granularity": "TOTAL",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "BILLING"
      ]
    }
  }
}

For ALL_ON_TWITTER, you have spend of $34.30; for `PUBLISHER_NETWORK, $1.587983. Together, you get $35.887983.

Hope this helps!


Campaign data mismatch for same account id
Campaign data mismatch for same account id