Java API Cove Sample Campaign_Performance_Report

27 views
Skip to first unread message

ntdm...@gmail.com

unread,
Oct 12, 2016, 6:21:45 AM10/12/16
to AdWords API Forum
Im an newbie to adwords, Im trying to get campaign performance report where you can get most of the campaign details can anyone share a code snippet to retrieve it I am able to get the campaigns, adgroups and ads but I  need a detailing on Campaign on the number of clicks, impressions etc.

A code snippet for java api  will be very useful 
Thanks in advance,

Peter Oliquino

unread,
Oct 12, 2016, 6:50:40 AM10/12/16
to AdWords API Forum
Hi,

You could try this example in Java and you may use the below sample AWQL query to generate the Campaign Performance Report :

String query = "SELECT CampaignId, CampaignName, Clicks, Impressions FROM CAMPAIGN_PERFORMANCE_REPORT"; 

For AdGroup and Ad performance specific reports, you may use the AdGroup Performance and Ad Performance reports respectively. You may also refer to this guide for more information regarding reports.

Best regards,
Peter
AdWords API Team

ntdm...@gmail.com

unread,
Oct 12, 2016, 8:12:05 AM10/12/16
to AdWords API Forum
Hi Peter,

It was useful thanks for the update but i need it to be in a object not to download as a file, what are the classes used to get the response and execute the query(service objects and return type objects so i can use them to do further operations).

Peter Oliquino

unread,
Oct 12, 2016, 11:14:41 PM10/12/16
to AdWords API Forum
Hi,

You may retrieve the response as a string object. Please refer to the below code for an example :

      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
      Comment out the save to file line
      //response.saveToFile(reportFile);
      String responseAsString = response.getAsString();
      You may then parse the String object as needed

Hope this helps.
Reply all
Reply to author
Forward
0 new messages