M
M
MrKMV342016-09-27 15:42:13
PHP
MrKMV34, 2016-09-27 15:42:13

How to get how much money spent per day in Google Adwords API?

How to get how much money spent per day on a campaign in Google Adwords API?
You can specify which service to use, because I could not find anything in 'CampaignService' or 'BudgetService', I looked at other services: there is nothing either.
You can immediately get an example code to get (php, java, python - it doesn't matter)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2016-09-27
@MrKMV34

Use the ReportDefinitionService service. PHP example:
https://developers.google.com/adwords/api/docs/sam...
The "Cost" field is the cost for campaigns.

<?
function DownloadCriteriaReportExample(AdWordsUser $user, $id, $start,$end) {
  $user->LoadService('ReportDefinitionService', 'v201603');
  $selector = new Selector();
  $selector->fields = array('CampaignId','CampaignName', 'Impressions', 'Clicks','Ctr', 'Cost', 'StartDate');
  $reportDefinition = new ReportDefinition();
  $reportDefinition->selector = $selector;
  $reportDefinition->reportName = 'Criteria performance report #' . uniqid();
  $reportDefinition->dateRangeType = 'CUSTOM_DATE';
  $startDate = $start;
  $endDate = $end;
  $selector->dateRange = new DateRange($startDate, $endDate);
  $reportDefinition->selector = $selector;
  $reportDefinition->reportType = 'CAMPAIGN_PERFORMANCE_REPORT';
  $reportDefinition->downloadFormat = 'CSV';
  // $reportDefinition->includeZeroImpressions = false;
  $options = array('version' => 'v201603');
  $filePath = dirname(__FILE__).'/upload/'.$id.'.csv';
  ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options);
  
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question