Ads API endpoint differs from analytics UI

api

#1

Hello!

I’m having trouble with the Ads API. I have a following use case:

  1. pick up last 3000 tweets with

/1.1/statuses/user_timeline.json

  1. build ads async jobs to get the relevant information

/2/stats/jobs/accounts/accountId?entity_ids=XXX&start_time=2018-01-26&end_time=2018-04-26&entity=ORGANIC_TWEET&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER

  1. retrieve the data from the jobs, parse them into database segmented by tweet and day

A few notes:

  • My account has only organic tweets
  • The impressions on tweets older than last 3000 are negligible
  • My examples are always on data at least a month old so the difference can’t be caused by missing the most recent data

When I double check with the UI, I have exactly the same number of tweets per day, and the numbers of impressions, retweets and likes (and other metrics) match almost perfectly on these tweets when compared to UI (and the export)

Selection_841

In the UI the aggregation per day is not allowed with per-tweet segmentation, all we see is the graph with all tweet impressions aggregated per day.

Selection_843

But when I try to aggregate my data from API per day, I get very different results, with almost 15% variance.
Where is this discrepancy coming from? What are the data shown in the graph if not aggregated values of all tweets per day?

Thank you very much for your help!
Karin


#2

Thanks for the question, @malapr0pism. Can you please provide a full example request, with account and entity IDs. Also, let’s look at a single Tweet to start.


#3

Hello! Thanks for the answer, so:

  1. I authenticate in the twurl and get a list of all tweets (I iterate through the max_id until I get desired amount - past two years in this case) and split them into groups of 20

twurl -H "api.twitter.com" "/1.1/statuses/user_timeline.json?screen_name=datapine&count=200"

So as you said, let’s focus on a single tweet. It’s an organic one. with string id = 956166983564910592

  1. So I make call on the jobs async api to get all the days (will have to do it multiple times to get all the days since tweet was created. I make sure to have days unique)

twurl -X POST -H "ads-api.twitter.com" "/2/stats/jobs/accounts/18ce53w2jra?entity_ids=956166983564910592&start_time=2018-02-02&end_time=2018-05-03&entity=ORGANIC_TWEET&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER"

(in this case another call with start_time=2018-01-01 and end_time=2018-02-02 in order to cover the whole existenece of the tweet)

the response is segmented per days

Selection_862

So I check the UI and get the aggregated number

which corresnds to the value from API, so obviously the problem is not here.

Selection_860

I checked these values for all the tweets. I don’t miss any tweets, nor days.

So I got all the data from the API to my db and group them by day. I would expect to get the same result as the UI shows here ->
Selection_864
but the difference is large, as I mentioned in the previous post. This happens in all my accounts.

Can you please help to cast a bit light on what do the values on the graph in the analytics UI consist of?

Thanks!
Have a nice day,
Karin