I want to get the Impressions of one Campain in per country.
my php code is here:
function Red_GA_GetCampainLocation($adWordsServices,$session,$timeMode)
{
$logDir = ROOT_PATH . '/logs/';
$tempName = uniqid();
$filePath = $logDir . $tempName.'.csv';
$selector = new Selector();
$selector->setFields(array('Id','CampaignId', 'Impressions'));
if (Red_GA_FindString($timeMode,"CUSTOM_DATE")) {
$infoArr = explode('|',$timeMode);
$tmpDate = new DateRange();
$tmpDate->setMin($infoArr[1]);
$tmpDate->setMax($infoArr[2]);
$selector->setDateRange($tmpDate);
$timeMode = "CUSTOM_DATE";
}
// Create report definition.
$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setReportName('CAMPAIGN performance report #' .
uniqid());
$reportDefinition->setDateRangeType($timeMode);
$reportDefinition->setReportType('CAMPAIGN_LOCATION_TARGET_REPORT');
$reportDefinition->setDownloadFormat('CSV');
$reportDownloader = new ReportDownloader($session);
$reportSettingsOverride = (new
ReportSettingsBuilder())->includeZeroImpressions(false)->build();
$reportDownloadResult =
$reportDownloader->downloadReport($reportDefinition,
$reportSettingsOverride);
$reportDownloadResult->saveToFile($filePath);
$file = fopen($filePath,"r");
$res = array();
while(! feof($file))
{
$res[] =fgetcsv($file);
}
fclose($file);
unlink($filePath);
return $res;
}
the result is :
["Location","Campaign ID","Impressions"],
[" --","11xxxxxxxx","67351"]
the Location is --. and a total Impressions. in all country.
who can tell me, how can i get the result like these(show the Impressions
of per country):
["Location","Campaign ID","Impressions"],
["2840","11xxxxxxxx","123"]
["2841","11xxxxxxxx","567"]
["2842","11xxxxxxxx","890"]
["2843","11xxxxxxxx","235"]
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/6939d3b9-7329-406f-a4d5-cb2ea1f250d5n%40googlegroups.com.