Hi @andrs,
Thanks for your response. I need to get all campaigns first so that i know the CampaignId I need to use for the endpoints you mentioned. I thought the first endpoint is to fetch all campaigns info but that endpoint, GET stats/accounts/:account_id/campaigns needs a query parameter âcampaign_idsâ which I donât have, please advise which endpoint to use to fetch all campaigns and their ids.
I tried the below endpoint to get list of all campaigns, GET accounts/:account_id/campaigns , i got list of campaigns, when I tried to use those campaign Ids for the GET endpoints you suggested above, I got the json with zero values, see URL 2 and 3 response below
I have removed information which can point to my account like account Id for security reasons. You will see something like âremovedâ , âACCTID REMOVEDâ
1. URL to fetch Campaigns: GET accounts/:account_id/campaigns
I used this endpoint to fetch all campaigns with their idâs and used these ids as campaign ids in the above endpoint to fetch stats on campaign. See part of json response below:
twurl -H ads-api.twitter.com â/0/accounts/ACCTIDREMOVED/campaigns?sort_by=start_time-desc&count=1000â
{ "account_id" : "removed",
"created_at" : "2015-05-15T17:22:20Z",
"currency" : "USD",
"daily_budget_amount_local_micro" : removed,
"deleted" : false,
"end_time" : null,
"funding_instrument_id" : "removed",
"id" : "2h0jp",
"name" : "TPN_DK_removed_320x50_RON_Android",
"paused" : false,
"reasons_not_servable" : [ ],
"servable" : true,
"standard_delivery" : true,
"start_time" : "2015-05-15T17:17:00Z",
"total_budget_amount_local_micro" : removed,
"updated_at" : "2015-05-15T17:22:20Z"
},
In this case, I used the id: 2h0jp as campaign id in the below URLs. For the same campaign name, the id is 7 digit numeric when fetched through UI in https://ads.twitter.com
I am not sure the Campaign Id returned by this endpoint is the correct one. I get a json response back with HTTP/200 with these ids but not actual stats.
When I check the stats returned by using âcampaign nameâ manually, for this given campaign Id, I have stats from UI export but not through API. Please note I only used campaign name as the ids did not match.
2. For URL: GET stats/accounts/:account_id/campaigns , I got the following json response. As you can see the values are zero.
twurl -H ads-api.twitter.com â/0/stats/accounts/ACCOUNTIDREMOVED/campaigns?campaign_ids=2h0jp&start_time=2015-05-26T22:00:00Z&granularity=DAYâ
{ "data" : [ { "billed_charge_local_micro" : [ 0,
0
],
"billed_engagements" : [ 0,
0
],
"billed_follows" : [ 0,
0
],
"end_time" : "2015-05-28T13:00:06Z",
"granularity" : "DAY",
"id" : "2h0jp",
"mobile_conversion_installs" : [ 0,
0
],
"mobile_conversion_installs_breakdown" : { "assisted" : [ 0,
0
],
"post_engagement" : [ 0,
0
],
"post_view" : [ 0,
0
],
"total" : [ 0,
0
]
},
"promoted_account_follow_rate" : [ 0.0,
0.0
],
"promoted_account_follows" : [ 0,
0
],
"promoted_account_impressions" : [ 0,
0
],
"promoted_account_profile_visits" : [ 0,
0
],
"promoted_tweet_app_install_attempts" : [ 0,
0
],
"promoted_tweet_app_open_attempts" : [ 0,
0
],
"promoted_tweet_search_card_engagements" : [ 0,
0
],
"promoted_tweet_search_clicks" : [ 0,
0
],
"promoted_tweet_search_engagement_rate" : [ 0.0,
0.0
],
"promoted_tweet_search_engagements" : [ 0,
0
],
"promoted_tweet_search_favorites" : [ 0,
0
],
"promoted_tweet_search_follows" : [ 0,
0
],
"promoted_tweet_search_impressions" : [ 0,
0
],
"promoted_tweet_search_replies" : [ 0,
0
],
"promoted_tweet_search_retweets" : [ 0,
0
],
"promoted_tweet_search_url_clicks" : [ 0,
0
],
"promoted_tweet_timeline_card_engagements" : [ 0,
0
],
"promoted_tweet_timeline_clicks" : [ 0,
0
],
"promoted_tweet_timeline_engagement_rate" : [ 0.0,
0.0
],
"promoted_tweet_timeline_engagements" : [ 0,
0
],
"promoted_tweet_timeline_favorites" : [ 0,
0
],
"promoted_tweet_timeline_follows" : [ 0,
0
],
"promoted_tweet_timeline_impressions" : [ 0,
0
],
"promoted_tweet_timeline_replies" : [ 0,
0
],
"promoted_tweet_timeline_retweets" : [ 0,
0
],
"promoted_tweet_timeline_url_clicks" : [ 0,
0
],
"start_time" : "2015-05-26T22:00:00Z"
} ],
"data_type" : "stats",
"request" : { "params" : { "account_id" : "ACCOUNTID REMOVED",
"campaign_ids" : [ "2h0jp" ],
"granularity" : "DAY",
"start_time" : "2015-05-26T22:00:00Z"
} }
}
3. For URL: GET stats/accounts/:account_id/campaigns/:id , I got the following output for the same campaign Id
twurl -H ads-api.twitter.com â/0/stats/accounts/ACCTIDREMOVED/campaigns/2h0jp?start_time=2015-05-26T22:00:00Z&granularity=DAYâ
{ âdataâ : { âbilled_charge_local_microâ : [ 0,
0
],
âbilled_engagementsâ : [ 0,
0
],
âbilled_followsâ : [ 0,
0
],
âend_timeâ : â2015-05-28T13:03:30Zâ,
âgranularityâ : âDAYâ,
âidâ : â2h0jpâ,
âmobile_conversion_installsâ : [ 0,
0
],
âmobile_conversion_installs_breakdownâ : { âassistedâ : [ 0,
0
],
âpost_engagementâ : [ 0,
0
],
âpost_viewâ : [ 0,
0
],
âtotalâ : [ 0,
0
]
},
âpromoted_account_follow_rateâ : [ 0.0,
0.0
],
âpromoted_account_followsâ : [ 0,
0
],
âpromoted_account_impressionsâ : [ 0,
0
],
âpromoted_account_profile_visitsâ : [ 0,
0
],
âpromoted_tweet_app_install_attemptsâ : [ 0,
0
],
âpromoted_tweet_app_open_attemptsâ : [ 0,
0
],
âpromoted_tweet_search_card_engagementsâ : [ 0,
0
],
âpromoted_tweet_search_clicksâ : [ 0,
0
],
âpromoted_tweet_search_engagement_rateâ : [ 0.0,
0.0
],
âpromoted_tweet_search_engagementsâ : [ 0,
0
],
âpromoted_tweet_search_favoritesâ : [ 0,
0
],
âpromoted_tweet_search_followsâ : [ 0,
0
],
âpromoted_tweet_search_impressionsâ : [ 0,
0
],
âpromoted_tweet_search_repliesâ : [ 0,
0
],
âpromoted_tweet_search_retweetsâ : [ 0,
0
],
âpromoted_tweet_search_url_clicksâ : [ 0,
0
],
âpromoted_tweet_timeline_card_engagementsâ : [ 0,
0
],
âpromoted_tweet_timeline_clicksâ : [ 0,
0
],
âpromoted_tweet_timeline_engagement_rateâ : [ 0.0,
0.0
],
âpromoted_tweet_timeline_engagementsâ : [ 0,
0
],
âpromoted_tweet_timeline_favoritesâ : [ 0,
0
],
âpromoted_tweet_timeline_followsâ : [ 0,
0
],
âpromoted_tweet_timeline_impressionsâ : [ 0,
0
],
âpromoted_tweet_timeline_repliesâ : [ 0,
0
],
âpromoted_tweet_timeline_retweetsâ : [ 0,
0
],
âpromoted_tweet_timeline_url_clicksâ : [ 0,
0
],
âstart_timeâ : â2015-05-26T22:00:00Zâ
},
âdata_typeâ : âstatsâ,
ârequestâ : { âparamsâ : { âaccount_idâ : âACCTID REMOVEDâ,
âcampaign_idâ : â2h0jpâ,
âgranularityâ : âDAYâ,
âstart_timeâ : â2015-05-26T22:00:00Zâ
} }
}
Thanks,
Nirmal