Hello,
I’m pulling line_item reports from the synchronous reports endpoint. My problem is the numbers I’m getting back in the report don’t seem to line up with what is showing in the Ad Console.
For example:
For Account ID: 90r4v
Line Item ID : cp0zb
For daterange: 2018-10-12 to 2018-10-19
The API is showing 191 impressions, 2 clicks, and 2 engagements (TOTAL for that period)
The Ad Console is showing 412,000 impressions and 60k clicks.
Clearly the number coming from the API is very off.
At first I thought I must be pulling from the wrong endpoint, but the Metric Group ENGAGEMENT seems to be correct.
I’m also getting the line item ids using the accounts/line_item end point.
Please help!
Here is the request portion of my code, in python:
promoted_tweets = []
url = ‘https://ads-api.twitter.com/4/accounts/90r4v/line_items’
auth = OAuth1(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
params = {
‘count’:‘20’,
‘with_deleted’:‘false’,
‘sort_by’:‘created_at-desc’,
#‘line_item_ids’:‘i21323198’
}
r = requests.get(url, auth=auth,params=params)
report = r.json()
for item in report[‘data’]:
id = item.get(‘id’)
print(item.get(‘name’))
print(item.get(‘id’))
promoted_tweets.append(id)
url = ‘https://ads-api.twitter.com/4/stats/accounts/90r4v’
auth = OAuth1(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
params = {
‘end_time’:today,
‘entity’:‘LINE_ITEM’,
‘entity_ids’:‘cp0zb’,
‘granularity’:‘TOTAL’,
‘metric_groups’:‘ENGAGEMENT’,
‘placement’:‘ALL_ON_TWITTER’,
‘start_time’:start_time
}
r = requests.get(url, auth=auth,params=params)
#print(r.text)
report = r.json()
report_data = report[‘data’]
print(report)
for item in report_data:
print(item)