Wrong Stats From Ad Analytics API

ads
bug
analytics

#1

I created a campaign a few days ago that has only ad, which was created today (20th Nov).

@juanshishido when I hit this endpoint stats/accounts/:account_id with a start_time to end_time from 19th Nov to 26th Nov (both midnight) it actually returns an enormous amount of impressions, amount spent etc. for the 19th, even though there was no active ad on the 19th. And btw, the same is reflected on the Ads Manager UI. Is this a known bug?

Thanks.


#2

@theusamaashraf: Thanks for the question. In order to help, we’re going to need more information. Please provide a specific example, with the associated Ads API requests and their responses, as well as what data you expect to see.


#3

@juanshishido

{ data_type: 'stats',
   time_series_length: 7,
   data:
    [ { id: '9vua2',
        id_data:
         [ { segment: null,
             metrics:
              { impressions: [ 5437, 6440, 0, 0, 0, 0, 0 ],
                tweets_send: null,
                billed_charge_local_micro: [ 10000000, 10000000, 0, 0, 0, 0, 0 ],
                qualified_impressions: null,
                follows: null,
                app_clicks: [ 13, 45, 0, 0, 0, 0, 0 ],
                retweets: [ 1, 1, 0, 0, 0, 0, 0 ],
                likes: [ 2, 8, 0, 0, 0, 0, 0 ],
                engagements: [ 45, 90, 0, 0, 0, 0, 0 ],
                clicks: [ 31, 44, 0, 0, 0, 0, 0 ],
                card_engagements: [ 13, 45, 0, 0, 0, 0, 0 ],
                poll_card_vote: null,
                replies: null,
                url_clicks: null,
                billed_engagements: null,
                carousel_swipes: null } } ] } ],
   request:
    { params:
       { start_time: '2017-11-19T20:00:00Z',
         segmentation_type: null,
         entity_ids: [ '9vua2' ],
         end_time: '2017-11-26T20:00:00Z',
         country: null,
         placement: 'ALL_ON_TWITTER',
         granularity: 'DAY',
         entity: 'CAMPAIGN',
         platform: null,
         metric_groups: [ 'ENGAGEMENT', 'BILLING' ] } } }

The entity is the campaign which has only one ad. The one ad was created yesterday (20th).
The first elements for the impressions, billed_charge_local_micro etc. arrays should all be 0. Some help would be greatly appreciated.


#4

Thanks for providing these details, @theusamaashraf.

You’re right that the Tweet was associated with the campaign’s line item on the 20th—at 2017-11-20T11:22:54Z:

$ twurl -H ads-api.twitter.com "/2/accounts/18ce545ghtr/promoted_tweets?line_item_ids=afcux"
{
  "request": {
    "params": {
      "account_id": "18ce545ghtr",
      "line_item_ids": [
        "afcux"
      ]
    }
  },
  "next_cursor": null,
  "data": [
    {
      "line_item_id": "afcux",
      "id": "1l6dmf",
      "entity_status": "ACTIVE",
      "created_at": "2017-11-20T11:22:54Z",
      "updated_at": "2017-11-20T11:22:54Z",
      "approval_status": "ACCEPTED",
      "tweet_id": {tweet_id},
      "deleted": false
    }
  ]
}

Looking at the data at HOUR granularity will help us see what’s going on. Here is the request for just the 20th and 21st (I’m only showing the impressions data to reduce the size of the response):

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce545ghtr?entity=CAMPAIGN&entity_ids=9vua2&start_time=2017-11-20&end_time=2017-11-22&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&granularity=HOUR"
{
  "data_type": "stats",
  "time_series_length": 48,
  "data": [
    {
      "id": "9vua2",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              0,0, 0,  0,  0,  0,  0,  0,   0,   0, 0, 0,0,0,0,5450,0,0,0,0,0,0,0,0,
              0,0,16,345,793,350,456,495,2519,2058,44,11,0,0,0,   0,0,0,0,0,0,0,0,0
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [...],
            "retweets": [...],
            "likes": [...],
            "engagements": [...],
            "clicks": [...],
            "card_engagements": [...],
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-11-19T20:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "9vua2"
      ],
      "end_time": "2017-11-21T20:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "HOUR",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

We don’t start seeing impressions for this campaign until the 16th element in the impressions array, which corresponds the hour between T11:00:00Z and T12:00:00Z. This is after the Tweet was associated with the line item.

Please let us know if this helps clarify. Thanks!


You can confirm that the specified line item ID is correct by checking:

# requesting the line items under campaign 9vua2
$ twurl -H ads-api.twitter.com "/2/accounts/18ce545ghtr/line_items?campaign_ids=9vua2"

#5

@juanshishido thanks so much for the detailed response. I think the time format was confusing me here.
Just one last thing; When we created the ad it received a lot of impressions (around 4k), clicks etc in a few minutes (for the 20th, which we wrongly thought was 19th). And the $10 per day budget was exhausted really fast even though we were using standard delivery. This is actually what raised an alarm on our end.

As I mentioned the campaign was created way before the ad and it remained without an ad for a couple of days I think. Could you please check whether the ad delivery was accelerated for some reason?

Thanks.


#6

@theusamaashraf: I get tripped up on the time zones sometimes, too.

As you can see if you make a request to the campaigns endpoint, standard_delivery is set to true. I don’t have much context around what you should expect in terms of pacing.


#7

@juanshishido if you look at the response you posted, that first 5450 looks like an anomaly. 5.4k impressions in one hour. And that seems to be right around the time the tweet was associated with the campaign’s line item.