How to get the total cost of a campaign through api

31 views
Skip to first unread message

Shan Pramuditha

unread,
May 7, 2018, 2:17:07 AM5/7/18
to AdWords API and Google Ads API Forum


I want to get the value bounded here.

Peter Oliquino (AdWords API Team)

unread,
May 7, 2018, 3:27:27 AM5/7/18
to AdWords API and Google Ads API Forum
Hi Shan,

You should be able to retrieve the said information by including the Cost field when you generate the Campaign Performance Report as you can see in my below sample SELECT query and results from my test account :

Sample query :

String query = "SELECT CampaignId, CampaignName, Cost FROM CAMPAIGN_PERFORMANCE_REPORT";

Results :

Campaign ID,Campaign,Cost
367020438,Interplanetary Cruise (Mars)#1460726846165,0
367027038,Interplanetary Cruise #1460729160735,0
368867478,Shoes Sale # 1461179448427,0
368871438,Shoes Sale # 1461180582528,0
641856392,Interplanetary Cruise banner 5 #1470898927628,0
661677735,Video campaign,0
678801542,Campaign 123,0
Total, --,0

Since I am using a test account, the total Cost would be 0 as test account data do not generate statistics. Even so, you could see that the total is included in the generated report. Feel free to write back if you have any further clarificaitions.

Thanks and regards,
Peter
AdWords API Team

Shan Pramuditha

unread,
May 7, 2018, 10:32:46 AM5/7/18
to AdWords API and Google Ads API Forum
Thank you for the help.I want this data from traffic estimater service. thanks

Peter Oliquino (AdWords API Team)

unread,
May 8, 2018, 12:16:13 AM5/8/18
to AdWords API and Google Ads API Forum
Hi Shan,

My apologies for the confusion. Currently the total campaign cost that you are seeing in the AdWords UI is not available via the AdWords API's TrafficEstimatorService as there is currently no Cost field in the CampaignEstimate object of the said service. However, you may still get the totalCost value from the StatsEstimate of the KeywordsEstimate and PlatformCampaignEstimate.

To learn more about estimating traffic via the AdWords API, you may refer to this guide.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages