My Problem
So the main problem is: i’m getting discrepancies in the api and on the twitter ads manager on two campaigns: ‘9vfi2,9vg46’
the other campaigns are giving me the right results. Just on both i can’t get the billing, impressions and clicks right. Hope i can have an answer for my problem.
The other campaign ids are: 9o3qr,9o43f,9pdao,9pddj,9s6s0,9tb5w,9tcij,9tcqg,9tcue,9tcwx and they´re giving me the right results.
I just need to extract: campaign_id,spend*, impressions and clicks.
*i think the spend should be equal to billing_charge_local_micro
This is my API call
import requests
content = requests.get('https://ads-api.twitter.com/2/stats/accounts/18ce54kpnge/', auth=twitterinit(),
params={
'start_time': datestart+'T00:00:00-0300',
'end_time': str(lastdate)+'T00:00:00-0300',
'entity': 'CAMPAIGN',
'granularity': 'TOTAL',
'metric_groups': 'ENGAGEMENT,BILLING',
'placement': 'ALL_ON_TWITTER',
'entity_ids': campaignslist
}).json()
The json response for both campaigns with this call on start_date and end_date set to 2017-11-23
{
id": "9vfi2",
"id_data": [
{
"metrics": {
"app_clicks": [
273
],
"billed_charge_local_micro": [
471564778
],
"billed_engagements": [
89
],
"card_engagements": [
273
],
"carousel_swipes": null,
"clicks": [
470
],
"engagements": [
769
],
"follows": [
4
],
"impressions": [
73196
],
"likes": [
48
],
"poll_card_vote": null,
"qualified_impressions": null,
"replies": [
4
],
"retweets": [
5
],
"tweets_send": [
2
],
"url_clicks": null
},
"segment": null
}
]
},
{
"id": "9vg46",
"id_data": [
{
"metrics": {
"app_clicks": [
158
],
"billed_charge_local_micro": [
285472181
],
"billed_engagements": [
60
],
"card_engagements": [
158
],
"carousel_swipes": null,
"clicks": [
373
],
"engagements": [
554
],
"follows": [
3
],
"impressions": [
52207
],
"likes": [
32
],
"poll_card_vote": null,
"qualified_impressions": null,
"replies": [
9
],
"retweets": [
5
],
"tweets_send": [
1
],
"url_clicks": null
},
"segment": null
}
]
},
Here’s the discrepance:
The campaigns with the problem are:
TT-RG-All-iOS-AppInstall,TT-RG-All-Android-AppInstall, the others are fine.