I use adwords api to create reports. Please carry me as I am not too familiar with this. I am using version v201409 from the api. I get report columns for KEYWORD_PERFORMANCE_REPORT using getReportFields. Then I try to load the report using a subset of these columns.
For KEYWORD_PERFORMANCE_REPORT I get an error message:
It is impossible to select the combination of devices and AssistClicks, AssistClicksOverLastClicks, AssistImpressions, AssistImpressionsOverLastClicks, AveragePageviews, AverageTimeOnSite, bounce rate, bounces, ClickAssistedConversionValue, ClickAssistedConversionValueLong, ClickAssistedConversionValueNonMoney, ClickAssistedConversions, ClickAssistedConversionsOverLastClickConversions, ImpressionAssistedConversionValue, ImpressionAssistedConversionValueLong, ImpressionAssistedConversionValueNonMoney, ImpressionAssistedConversions, ImpressionAssistedConversionsOverLastClickConversions, LastClickConversions, LastClicks, NewVisitors, viewed, PercentNewVisitors, VisitDuration, views, Type: ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT.
The question arises: how to find out the correct set of combinations of columns without going through the trial and error process. Is there any documentation that will help me with the same.
I looked at the columns for KEYWORD_PERFORMANCE_REPORT at http://developers.guge.io/adwords/api/docs/appendix/reports and excluded the numbers that api said "incompatible". Received a similar error. Thanks
N.B > , -, , .
: ` String [] columnNames = { "ConversionRateManyPerClickSignificance", "ConversionRateSignificance", "ViewThroughConversionsSignificance", "AccountCurrencyCode", "AccountDescriptiveName", "AccountTimeZoneId", "AdGroupId", "AdGroupName", "AdGroupStatus", "AssistImpressions", "AssistImpressionsOverLastClicks", "AverageCpc", "AverageCpm", "AveragePageviews", "AveragePosition", "AverageTimeOnSite", "BiddingStrategyId", "BiddingStrategyName", "BiddingStrategyType", "CampaignId", " ", "CampaignStatus", "ClickAssistedConversionsOverLastClickConversions", "ClickAssistedConversionValue", "", "ClickSignificance", "ClickType", "ConversionManyPerClickSignificance", "ConversionRate", "ConversionRateManyPerClick", "", "ConversionSignificance", "ConversionsManyPerClick", "ConversionTypeName", "ConversionValue", "", "CostPerConversion", "CostPerConversionManyPerClick", "CostPerConversionManyPerClickSignificance", "CostPerConversionSignificance", "CostSignificance", "CpcBid", "CpcBidSource", "CpmBid", "CpmSignificance", "CriteriaDestinationUrl", "Ctr", "CtrSignificance", "CustomerDescriptiveName", "CvrSignificance", "", " ", "", "ExternalCustomerId", "FinalAppUrls", "FinalMobileUrls", "FinalUrls", "FirstPageCpc", " ", "ImpressionAssistedConversions", "ImpressionAssistedConversionsOverLastClickConversions", "ImpressionAssistedConversionValue", "", "ImpressionSignificance", "IsNegative", "KeywordMatchType", "LabelIds", "", "", "MonthOfYear", "PlacementUrl", "PositionSignificance", "PrimaryCompanyName", "QualityScore", "", "SearchExactMatchImpressionShare", "SearchImpressionShare", "SearchRankLostImpressionShare", "", "TrackingUrlTemplate", "UrlCustomParameters", "ValuePerConversion", "ValuePerConversionManyPerClick", "ViewThroughConversions", "", ""
};
public static void downloadConsolidatedReportFile(String[] columnNames, final ReportDefinitionDateRangeType forDateRange, final ReportDefinitionReportType reportDefinitionReportType, final String to) throws Exception {
com.google.api.ads.adwords.lib.jaxb.v201409.Selector selector = new com.google.api.ads.adwords.lib.jaxb.v201409.Selector();
selector.getFields().addAll(Lists.newArrayList(columnNames));
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("Report " + reportDefinitionReportType.value() + " for dateRange " + forDateRange.value());
reportDefinition.setDateRangeType(forDateRange);
reportDefinition.setReportType(reportDefinitionReportType);
reportDefinition.setDownloadFormat(DownloadFormat.CSV);
ReportingConfiguration reportingConfiguration = new ReportingConfiguration.Builder()
.skipReportHeader(true)
.skipReportSummary(true)
.build();
session.setReportingConfiguration(reportingConfiguration);
reportDefinition.setSelector(selector);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(to)));
String mccId = session.getClientCustomerId();
Collection<Client> clientIds = getClientAccountIds(mccId);
try {
for (Client cl : clientIds) {
BufferedReader reader = null;
String customerId = cl.id;
String name = cl.name;
session.setClientCustomerId(cl.id);
try {
ReportDownloadResponse response =
new ReportDownloader(session).downloadReport(reportDefinition);
if (response == null || response.getHttpStatus() != 200) {
handleError(response);
}
BufferedInputStream bs = new BufferedInputStream(response.getInputStream());
reader = new BufferedReader(new InputStreamReader(bs));
String line = null;
log.info("getting " + reportDefinition.getReportType().value() + " for " + customerId+" "+name);
reader.readLine();
while ((line = reader.readLine()) != null) {
bw.write(line + "\n");
}
} catch (DetailedReportDownloadResponseException e) {
log.error("An error was thrown downloading report for Customer id: " + customerId+" "+name, e);
if (e.getType().equals("ReportDefinitionError." + ReportDefinitionErrorReason.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH.getValue())) {
continue;
} else {
throw e;
}
} catch (Exception e) {
log.error("An error was thrown downloading report for Customer id: " + customerId+" "+name, e);
throw e;
} finally {
if (reader != null) {
reader.close();
}
}
}
} finally {
if (bw != null) {
bw.flush();
bw.close();
}
}
}
`
, , .