Hi Anash, Thank you for this. What I don't understand is I am not trying to generate a report for multiple clients. I have a single customer Id, and I want to generate a report for that customer id. This used to work fine with v201109.
So if in 201209 this is not supported, how do generate a report (E.G. AD_PERFORMANCE_REPORT) per client in the AdWords account, including any sub clients? Greg. On Wednesday, November 14, 2012 3:36:51 AM UTC+2, Anash P. Oommen wrote: > > Hi Greg, > > AdWords API doesn't support reports at MCC level, and it indicates so by > throwing CUSTOMER_SERVING_TYPE_REPORT_MISMATCH error. If you need to > generate a report for multiple customers, you need to download them one > AdWords account at a time and then combine it locally. We have a java code > example that shows how this may be done. You can find it at > http://code.google.com/p/google-api-adwords-java/source/browse/apps/multipleclientreportdownloader/src/com/google/api/adwords/reportdownload/MultipleClientReportDownloaderMain.java > > Cheers, > Anash P. Oommen, > AdWords API Advisor. > > On Monday, 12 November 2012 15:24:01 UTC-8, Greg Gunner wrote: >> >> Hi, >> >> I am upgrading an application to support 201209. It seems the Report >> Definition Services is failing. I get the error: "Report download failed. >> Underlying errors are Type = >> 'ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH', Trigger = >> '', FieldPath = 'selector'." >> >> As I understand it, this is the issue: >> https://developers.google.com/adwords/api/docs/troubleshooting?hl=en#ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH >> >> Can anyone help as to what is the correct strategy to support the >> reporting we are after? >> >> The application generates custom reports for clients, some of whom also >> manage multiple accounts. >> >> For example, we have the below code: >> >> ***** >> function getReportData($report_type, $report_name, $customer_id = null, >> $fields = array(), $predicates = array(), $date_range = null) >> { >> require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php'; >> require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php'; >> try { >> //set the user >> $user = $this->setUser(); >> //set the customer id >> if ($customer_id !== null) { >> $user->SetClientId($customer_id); >> } >> $results = array(); >> // Load the service, so that the required classes are available. >> $user->LoadService('ReportDefinitionService', 'v201209'); >> // Create selector. >> $selector = new Selector(); >> $selector->fields = $fields; >> // Create predicates. >> if (!empty($predicates)) { >> //$predicates = array(array('field' => 'Status', 'operator' => 'IN', >> 'values' => array('ENABLED', 'PAUSED'))); >> foreach ($predicates as $predicate) { >> $predicate = array_merge(array('field' => null, 'operator' => null, >> 'values' => null), $predicate); >> if (!empty($predicate['field']) && !empty($predicate['operator']) && >> !empty($predicate['values'])) { >> $selector->predicates[] = new Predicate($predicate['field'], >> $predicate['operator'], $predicate['values']); >> } >> } >> } >> >> // Create report definition. >> $definition = new ReportDefinition(); >> //add the date range >> if (!empty($date_range)) { >> //set the date >> if (is_string($date_range)) { >> $definition->dateRangeType = $date_range; >> } else { >> $definition->dateRangeType = 'CUSTOM_DATE'; >> $selector->dateRange->min = $date_range['min']; >> $selector->dateRange->max = $date_range['max']; >> } >> } >> //set the report defaults >> $definition->reportName = $report_name; >> $definition->reportType = $report_type; >> $definition->downloadFormat = $this->download_format; >> // Exclude criteria that haven't recieved any impressions over the date >> range. >> $definition->includeZeroImpressions = FALSE; >> //add the selector >> $definition->selector = $selector; >> // Set additional options. >> $options = array('version' => 'v201209', 'returnMoneyInMicros' => FALSE); >> //get the report >> return $this->returnResult(ReportUtils::DownloadReport($definition, null, >> $user, $options)); >> } catch(Exception $e) { >> $this->last_error = $e->getMessage(); >> } >> return false; >> } >> >> >> function setUser() >> { >> if (!isset($this->AdWordsUser)) { >> App::import('Model', 'Setting'); >> $Setting =& new Setting(); >> $this->AdWordsUser = new AdWordsUser( >> null, >> $Setting->get('adwords_email'), >> $Setting->get('adwords_password'), >> $Setting->get('adwords_developer_token'), >> null, >> $Setting->get('adwords_user_agent') >> ); >> } >> if ($this->log) { >> $this->AdWordsUser->LogAll(); >> } >> return $this->AdWordsUser; >> } >> ***** >> >> This is called by... >> ***** >> return $this->getReportData( >> 'KEYWORDS_PERFORMANCE_REPORT', >> 'Keyword performance report', >> $customer_id, >> array( >> 'ExternalCustomerId', >> 'DayOfWeek', >> 'CampaignId', >> 'CampaignName', >> 'CampaignStatus', >> 'AdNetworkType1', >> 'AdGroupId', >> 'AdGroupName', >> "AdGroupStatus", >> 'Id', >> 'KeywordText', >> 'KeywordMatchType', >> 'Status', >> 'Clicks', >> 'Cost', >> 'Conversions', >> 'ConversionsManyPerClick', >> 'ConversionRate', >> 'ConversionRateManyPerClick', >> 'TotalConvValue', >> 'CostPerConversion', >> 'CostPerConversionManyPerClick', >> >> 'Impressions', >> 'Ctr', >> 'AverageCpc', >> 'AverageCpm', >> 'AveragePosition', >> 'MaxCpc', >> 'MaxCpm', >> 'IsNegative', >> //'PreferredPosition',//no nonger available >> //'BottomPosition',//no nonger available >> >> //"KeywordTypeDisplay", >> //"KeywordMinCPC", >> //"MaxContentCPC", >> //"PreferredCPC", >> //"PreferredCPM", >> //"KeywordDestUrlDisplay", >> ), >> array( >> array('field' => 'Status', 'operator' => 'IN', 'values' => >> array('ACTIVE')), >> array('field' => 'AdNetworkType1', 'operator' => 'IN', 'values' => >> array('SEARCH')) >> ), >> $date_range); >> ***** >> >> >> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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