When pulling data for a campaign from the Ads API the spend figures returned do not seem to reflect the daily budget caps that are in place.

For example, campaign ID 21087487 with date range = 2018-07-18 to 2018-07-24 inclusive

The daily budget cap in place for this campaign is 28.74

Impressions reported in the UI = 39,251
Spend reported in UI = £201.18 (exactly equal to 7 X 28.74)

When we pull this data from the API we get the exact same number of Impressions but a different spend figure of 254.71

The spend cap seems to have worked on 20th July but no other day during this time period.

Should we expect the API to reflect the budget caps?
Do we need to use a different metric to billed_spend_micro?

Let me know if we can provide further information to help you investigate this.

Thanks

Hello, @brightanalytics. Thanks for reaching out and providing these details.

I just made the following request, which shows a daily spend amount of £24.74.

$ twurl -H ads-api.twitter.com "/5/stats/accounts/18ce54lwh4a?entity=CAMPAIGN&entity_ids=cjz7j&start_time=2019-07-18&end_time=2019-07-25&granularity=DAY&placement=ALL_ON_TWITTER&metric_groups=BILLING"
{
  "data_type": "stats",
  "time_series_length": 7,
  "data": [
    {
      "id": "cjz7j",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "billed_charge_local_micro": [
              28740000,
              28740000,
              28740000,
              28740000,
              28740000,
              28740000,
              28740000
            ],
            "billed_engagements": [
              10,
              9,
              10,
              11,
              21,
              19,
              26
            ]
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2019-07-17T23:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "cjz7j"
      ],
      "end_time": "2019-07-24T23:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "DAY",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "BILLING"
      ]
    }
  }
}

Do you see any differences between this and the Ads API request you made?

Hi. Ah … we are pulling the data at a promoted tweet level as our client needs to analyse performance of individual tweets : would I be right in thinking budget caps belong to campaigns and don’t get applied to the spend data on entities at a more granular level? Doesn’t feel right that different results can be obtained for the same campaign depending on the granularity of reporting.

That would be incorrect. They do get applied across the different levels of the tree.

If, for a given budget-capped campaign, there is only one line item under it and only one Tweet associated with that line item, the numbers will match.

For cases where there are multiple entities under a campaign, the sum of the metrics at a given level should match the values you pull for it’s parent.

Doesn’t feel right that different results can be obtained for the same campaign depending on the granularity of reporting.

Could you provide an example of where you’re seeing differences? The actual API request and response as well as what you expect to see and why.

Thanks!

Hi

It seems that the discrepancy arises only when we add in segmentation to the request. We are pulling at promoted_tweet level for the BILLING metric group.

When we do not specify a segmentation_type we get data that is capped and matches the UI:

https://ads-api.twitter.com/4/stats/jobs/accounts/18ce54lwh4a?oauth_consumer_key=XXX&oauth_signature_method=HMAC-SHA1&oauth_token=XXX&oauth_timestamp=1565965582&oauth_version=1.0&account=18ce54lwh4a&entity=PROMOTED_TWEET&entity_ids=3bm7zq%2C3bm80e%2C3bm81b%2C3jb51o%2C3jb51p%2C3jupro%2C3jxnbv%2C3jxncd%2C3kptnv&start_time=2019-07-18T00%3A00%3A00%2B01%3A00&end_time=2019-07-19T00%3A00%3A00%2B01%3A00&granularity=HOUR&placement=ALL_ON_TWITTER&metric_groups=BILLING

As soon as we include segmentation_type=PLATFORM argument we get uncapped spend and it doesn’t match the UI:

https://ads-api.twitter.com/4/stats/jobs/accounts/18ce54lwh4a?oauth_consumer_key=XXX&oauth_nonce=XXX&oauth_signature_method=HMAC-SHA1&oauth_token=XXX&oauth_timestamp=1565966448&oauth_version=1.0&account=18ce54lwh4a&entity=PROMOTED_TWEET&entity_ids=3bm7zq%2C3bm80e%2C3bm81b%2C3jb51o%2C3jb51p%2C3jupro%2C3jxnbv%2C3jxncd%2C3kptnv&start_time=2019-07-18T00%3A00%3A00%2B01%3A00&end_time=2019-07-19T00%3A00%3A00%2B01%3A00&granularity=HOUR&placement=ALL_ON_TWITTER&segmentation_type=PLATFORMS&metric_groups=BILLING

Hope this helps.

Thanks

Thanks, @brightanalytics.

It seems that the discrepancy arises only when we add in segmentation to the request.

What you’re seeing is expected. Please take a look at our Analytics FAQs.