You can get a report for all clients.

The php in the first post is wrong.  Where it says:
      $user = new AdWordsUser();
      $user->SetClientId(eigene ID);
      $user->LogDefaults();

Escape out the second line:
      $user = new AdWordsUser();
      //$user->SetClientId(eigene ID);
      $user->LogDefaults();
and the report will be generated for all clients that you have access
to.


Also, if you want to actually KNOW which account each keyword belongs
to (or adGroup, whatever kind of report you're running):
$selector->fields = array('AdGroupId', 'Id', 'KeywordText',
      'KeywordMatchType', 'Impressions', 'Clicks', 'Cost');
You should add 'ExternalCustomerId' as a selector.


Please reference 'AddCrossClientReportDefinition.php' in your examples
folder.
That script will return $reportDefinition->id - you need to use that
id in another script:
DownloadCrossClientReport.php

which will have the line:
$reportDefinitionId = (float) '';

Just add your $reportDefinition->id there and you should be able to
download it.



The following is a script that works for adding a cross-client report
definition.  I've left all my notes in (there are WAY too many fields
in the selector - you probably don't want all those.  If you need to
find all the options for a report, use 'GetReportFields.php'), so
you'll have to modify the file for it to work:

try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();

  // Log SOAP XML request and response.
  $user->LogDefaults();

  // Get the GetReportDefinitionService.
  $reportDefinitionService = $user-
>GetReportDefinitionService('v201101');

  // Create selector.
  $selector = new Selector();

//$selector->fields = array('ExternalCustomerId',
'AccountDescriptiveName', 'PrimaryUserLogin', 'Date',
'AdNetworkType2', 'ValuePerConversion', 'AveragePosition',
'AverageCpc', 'AverageCpm', 'Ctr', 'CampaignName', 'CampaignId',
'Status', 'Clicks', 'AccountTimeZoneId', 'ConversionRate',
'Conversions', 'Cost', 'CostPerConversion',
'CostPerConversionManyPerClick', 'DerivedDailyBudget', 'Impressions',
'InvalidClicks', 'InvalidClickRate', 'TotalConvValue',
'ConversionsManyPerClick', 'ExactMatchImpressionShare',
'ImpressionShare', 'BudgetLostImpressionShare',
'QualityLostImpressionShare'); //fields for cross-client campaign
performance report

$selector->fields = array('AdGroupId', 'AdGroupName',
'AdNetworkType1', 'AdNetworkType2', 'AverageCpc', 'AverageCpm',
'AveragePosition',  'CampaignId', 'CampaignStatus', 'Clicks',
'ConversionOptimizerBidType', 'ConversionRate',
'ConversionRateManyPerClick', 'Conversions',
'ConversionsManyPerClick', 'ConversionValue', 'Cost',
'CostPerConversion', 'CostPerConversionManyPerClick', 'Ctr', 'Date',
'DeduplicationMode', 'EnhancedCpcEnabled', 'ExternalCustomerId', 'Id',
'Impressions', 'KeywordContentMaxCpc', 'KeywordMaxCpc', 'MaxCpm',
'PercentCpa', 'ProxyKeywordMaxCpc', 'ProxySiteMaxCpc', 'SiteMaxCpc',
'Slot', 'Status', 'TargetCpa', 'TotalConvValue', 'ValuePerConv',
'ValuePerConversion', 'ValuePerConversionManyPerClick',
'ValuePerConvManyPerClick', 'ViewThroughConversions'); //adGroup
report

$selector->fields = array('Date', 'ExternalCustomerId', 'Id',
'CampaignId', 'AdGroupId', 'Status', 'KeywordText', 'AdNetworkType2',
'Impressions', 'Clicks', 'ConversionRate', 'Conversions', 'Cost',
'CostPerConversion', 'AverageCpc', 'AverageCpm', 'AveragePosition'); //
keword report

  // Create report definition.
  $reportDefinition = new ReportDefinition();
  $reportDefinition->reportName = 'whatever'; //. uniqid();

  $reportDefinition->dateRangeType = 'CUSTOM_DATE';
  $reportDefinition->dateRangeType = 'YESTERDAY';
  //$selector->dateRange = new DateRange('20110101','20111012');
  //$reportDefinition->dateRangeType = 'THIS_MONTH';
  $reportDefinition->reportType = 'KEYWORDS_PERFORMANCE_REPORT';
  //$reportDefinition->reportType = 'ADGROUP_PERFORMANCE_REPORT';
  //$reportDefinition->reportType = 'CAMPAIGN_PERFORMANCE_REPORT';
  //$reportDefinition->reportType = 'ACCOUNT_PERFORMANCE_REPORT';
  $reportDefinition->downloadFormat = 'CSV';
  $reportDefinition->selector = $selector;
  $reportDefinition->crossClient = TRUE;

  // Create operations.
  $operation = new ReportDefinitionOperation();
  $operation->operand = $reportDefinition;
  $operation->operator = 'ADD';

  $operations = array($operation);

  // Add report definition.
  $result = $reportDefinitionService->mutate($operations);

  // Display report definitions.
  if ($result != null) {
    foreach ($result as $reportDefinition) {
      printf("Report definition with name '%s' and id '%s' was added.
\n",
          $reportDefinition->reportName, $reportDefinition->id);
    }
  } else {
    print "No report definitions were added.\n";
  }
} catch (Exception $e) {
  print $e->getMessage();
}


On Nov 3, 7:47 am, scrat <weigel.andr...@googlemail.com> wrote:
> Is it now possible to run report on behalf of a mcc account using
> Adhoc Reports?
>
> I also couldn't download a predefined report of a mcc report using
> DownloadReport function of the ReportUtils
>
> Following Error occured:
> "Improperly formatted report request"
>
> So the only way to get reports of all clients of a mcc accoutn is to
> walk through all clients and download a separat adhoc report!?
>
> Best regards
> Andreas
>
> On 27 Sep., 22:02, Eric Koleda <eric.kol...@google.com> wrote:
>
>
>
>
>
>
>
> > Hi Ezequiel,
>
> > Can you double-check that the Customer ID in the clientCustomerId header
> > corresponds to a regular ad-serving account instead of an MCC account?
>
> > Best,
> > - Eric Koleda, AdWords API Team

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to