the Campain Location help

45 views
Skip to first unread message

Mu Tyr

unread,
Dec 21, 2020, 12:25:54 PM12/21/20
to AdWords API and Google Ads API Forum
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"]

Google Ads API Forum Advisor Prod

unread,
Dec 22, 2020, 6:43:31 AM12/22/20
to mut...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for raising your concern.

I am afraid that it is not possible to get the data/metrics per country using CAMPAIGN_LOCATION_TARGET_REPORT.

You may use the Geo Performance Report instead, use the IsTargetingLocation as a filter and set it as true. By doing this, you can retrieve the statistics aggregated at the country/territory level, one row per country/territory of the campaign's targeted location. Also, you can include the CountryCriteriaIdCampaignId, and Impressions fields.

Let me know if you have further questions.
 
Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q29TgNv:ref

Mu Tyr

unread,
Dec 22, 2020, 11:38:11 AM12/22/20
to AdWords API and Google Ads API Forum
hi  adsapiforumadvisor ,
my  campaign is  Universal App Campaign.   Geo Performance Report  can not use for   Universal App Campaign  

Google Ads API Forum Advisor Prod

unread,
Dec 23, 2020, 2:51:04 AM12/23/20
to mut...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for the additional information. I work with Ernie and allow me to assist you for now.

I would recommend that you use the Google Ads API reporting instead and generate the geographic_view. This is because the Google Ads API's reports should have more support for app campaign information in its reports.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q29TgNv:ref
Reply all
Reply to author
Forward
0 new messages