Not getting data on /1/stats/accounts/<acc-id>

restapi
analytics
api

#1

I am trying to use Twurl to get back twitter analytics data.
When issuing:
twurl -H ads-api.twitter.com ‘/1/stats/accounts/{Ads-acc-id}?entity_ids={Ads-acc-id}&entity=ACCOUNT&end_time=2016-07-19T17:00:00Z&granularity=TOTAL&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&start_time=2016-07-12T16:00:00Z’|python -m json.tool

I am getting back are null values including impressions:
But, when exporting the data through the export button on the same date range, through, the “impressions=3”

Here is the json response:
{
“data”: [
{
“id”: xxxxx,
“id_data”: [
{
“metrics”: {
“engagements”: null,
“follows”: null,
“impressions”: null,
“likes”: null,
“replies”: null,
“retweets”: null
},
“segment”: null
}
]
}
],
“data_type”: “stats”,
“request”: {
“params”: {
“country”: null,
“end_time”: “2016-07-19T17:00:00Z”,
“entity”: “ACCOUNT”,
“entity_ids”: null,
“granularity”: “TOTAL”,
“metric_groups”: [
“ENGAGEMENT”
],
“placement”: “ALL_ON_TWITTER”,
“platform”: null,
“segmentation_type”: null,
“start_time”: “2016-07-12T16:00:00Z”
}
},
“time_series_length”: 1
}


#2

One common reason for seeing discrepancies between the UI and the API is differences in time ranges (specifically, time zones) in queries. The API operates in UTC time, while the UI uses the time zone of the advertiser account. Therefore, you might be inadvertently making requests that actually differ by a couple of hours.

For example, the start_time you’re passing in to the API in your above request is 2016-07-12 16:00:00 UTC, but if you passed in 2016-07-12 16:00:00 to the UI and the account’s timezone is set to PST, it would actually be the equivalent of 2016-07-13 9:00 UTC


#3

Thank you for your reply. Yes, I understand this, but I have waited one-day and I am still seeing the issue.
If you see the time range is almost one week. So, the 7 hours UTC, PST difference is already included.
I am always getting impressions=null and I have tried several time ranges.


#4

Could you send us the full request and response you’re getting from the API, as well as the export you retrieved from ads.twitter.com? Feel free to remove any sensitive information, but please do leave in Ads API object ids (account_id, campaign_id, etc) as it will help us to reproduce/confirm the issue.

Without seeing the exact details of the API request/response and export, it’s hard for us to diagnose or triage the issue.


#5

OK, sure, here is the CSV export for 7/17 - 7/19:
Tweet id Tweet permalink Tweet text time impressions engagements engagement rate retweets replies likes user profile clicks url clicks hashtag clicks detail expands permalink clicks app opens app installs follows email tweet dial phone media views media engagements promoted impressions promoted engagements promoted engagement rate promoted retweets promoted replies promoted likes promoted user profile clicks promoted url clicks promoted hashtag clicks promoted detail expands promoted permalink clicks promoted app opens promoted app installs promoted follows promoted email tweet promoted dial phone promoted media views promoted media engagements
7.55169E+17 https://twitter.com/STFUandGitPush/status/755168779890327552 Test Tweet-2 2016-07-18 22:34 +0000 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - - - - - - - - - - - - - - - - - -

The impressions field is 47!

And here is the Twurl call: twurl -H ads-api.twitter.com ‘/1/stats/accounts/18ce54cq4k3?entity_ids=18ce54cq4k3&entity=ACCOUNT&end_time=2016-07-20T17:00:00Z&granularity=TOTAL&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&start_time=2016-07-17T16:00:00Z’|python -m json.tool
{
“data”: [
{
“id”: “18ce54cq4k3”,
“id_data”: [
{
“metrics”: {
“engagements”: null,
“follows”: null,
“impressions”: null,
“likes”: null,
“replies”: null,
“retweets”: null
},
“segment”: null
}
]
}
],
“data_type”: “stats”,
“request”: {
“params”: {
“country”: null,
“end_time”: “2016-07-20T17:00:00Z”,
“entity”: “ACCOUNT”,
“entity_ids”: null,
“granularity”: “TOTAL”,
“metric_groups”: [
“ENGAGEMENT”
],
“placement”: “ALL_ON_TWITTER”,
“platform”: null,
“segmentation_type”: null,
“start_time”: “2016-07-17T16:00:00Z”
}
},
“time_series_length”: 1
}


#6

@bpirvali,
can you post here how this issue was resolved?
I am also seeing the same issue.

thank you.


#7

@JerryAclan: This simply means that there was no data for the time period you’re making the request for.

For example, the following campaign only has PUBLISHER_NETWORK engagement for the time period specified. The ALL_ON_TWITTER data is all null.

# Publisher Network
$ twurl -H ads-api.twitter.com "/1/stats/accounts/18ce54d4x5t?start_time=2016-09-19&end_time=2016-09-24&entity=CAMPAIGN&entity_ids=5v90x&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=PUBLISHER_NETWORK" | jq
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "5v90x",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [
              4
            ],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [
              1
            ],
            "retweets": null,
            "likes": null,
            "engagements": [
              1
            ],
            "clicks": [
              1
            ],
            "card_engagements": null,
            "replies": null,
            "url_clicks": [
              1
            ],
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2016-09-19T07:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "5v90x"
      ],
      "end_time": "2016-09-24T07:00:00Z",
      "country": null,
      "placement": "PUBLISHER_NETWORK",
      "granularity": "TOTAL",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}
# All on Twitter
$ twurl -H ads-api.twitter.com "/1/stats/accounts/18ce54d4x5t?start_time=2016-09-19&end_time=2016-09-24&entity=CAMPAIGN&entity_ids=5v90x&metric_groups=ENGAGEMENT&granularity=TOTAL&placement=ALL_ON_TWITTER" | jq
{
  "data_type": "stats",
  "time_series_length": 1,
  "data": [
    {
      "id": "5v90x",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": null,
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": null,
            "retweets": null,
            "likes": null,
            "engagements": null,
            "clicks": null,
            "card_engagements": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2016-09-19T07:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "5v90x"
      ],
      "end_time": "2016-09-24T07:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "TOTAL",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

Unauthorized_access