如何找出adwords中哪些列组合有效

时间:2015-02-25 18:10:33

标签: google-api google-adwords

我使用adwords api生成报告。 请耐心等待,因为我对此并不太熟悉。 我正在使用api的v201409版本。 我使用getReportFields获取KEYWORD_PERFORMANCE_REPORT的报告列。 然后,我尝试使用这些列的子集下载报告。

对于KEYWORD_PERFORMANCE_REPORT,我收到错误:

  

无法选择Device和的组合   AssistClicks,AssistClicksOverLastClicks,AssistImpressions,AssistImpressionsOverLastClicks,AveragePageviews,AverageTimeOnSite,BounceRate,反弹,ClickAssistedConversionValue,ClickAssistedConversionValueLong,ClickAssistedConversionValueNonMoney,ClickAssistedConversions,ClickAssistedConversionsOverLastClickConversions,ImpressionAssistedConversionValue,ImpressionAssistedConversionValueLong,ImpressionAssistedConversionValueNonMoney,ImpressionAssistedConversions,ImpressionAssistedConversionsOverLastClickConversions,LastClickConversions,LastClicks,新访问者,浏览量,PercentNewVisitors,VisitDuration,参观,   键入:ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT。

问题是:如何在不经过试错过程的情况下找到一组有效的列组合。是否有任何文档可以帮助我。

我查看了http://developers.guge.io/adwords/api/docs/appendix/reports中KEYWORD_PERFORMANCE_REPORT的列,并排除了api所说的列#34;不兼容"。得到了类似的错误。 感谢

N.B>如果我使用在线示例中提供的列来尝试此代码,它可以正常工作并下载报告。 代码是:     `     String [] columnNames = {                 " ConversionRateManyPerClickSignificance&#34 ;,                 " ConversionRateSignificance&#34 ;,                 " ViewThroughConversionsSignificance&#34 ;,                 " AccountCurrencyCode&#34 ;,                 " AccountDescriptiveName&#34 ;,                 " AccountTimeZoneId&#34 ;,                 " AdGroupId&#34 ;,                 " AdGroupName&#34 ;,                 " AdGroupStatus&#34 ;,                 " AssistImpressions&#34 ;,                 " AssistImpressionsOverLastClicks&#34 ;,                 " AverageCpc&#34 ;,                 " AverageCpm&#34 ;,                 " AveragePageviews&#34 ;,                 " AveragePosition&#34 ;,                 " AverageTimeOnSite&#34 ;,                 " BiddingStrategyId&#34 ;,                 " BiddingStrategyName&#34 ;,                 " BiddingStrategyType&#34 ;,                 " CAMPAIGNID&#34 ;,                 " CAMPAIGNNAME&#34 ;,                 " CampaignStatus&#34 ;,                 " ClickAssistedConversionsOverLastClickConversions&#34 ;,                 " ClickAssistedConversionValue&#34 ;,                 "点击&#34 ;,                 " ClickSignificance&#34 ;,                 "点击类型&#34 ;,                 " ConversionManyPerClickSignificance&#34 ;,                 " ConversionRate&#34 ;,                 " ConversionRateManyPerClick&#34 ;,                 "换算&#34 ;,                 " ConversionSignificance&#34 ;,                 " ConversionsManyPerClick&#34 ;,                 " ConversionTypeName&#34 ;,                 " ConversionValue&#34 ;,                 "成本&#34 ;,                 " CostPerConversion&#34 ;,                 " CostPerConversionManyPerClick&#34 ;,                 " CostPerConversionManyPerClickSignificance&#34 ;,                 " CostPerConversionSignificance&#34 ;,                 " CostSignificance&#34 ;,                 " CpcBid&#34 ;,                 " CpcBidSource&#34 ;,                 " CpmBid取代&#34 ;,                 " CpmSignificance&#34 ;,                 " CriteriaDestinationUrl&#34 ;,                 " CTR&#34 ;,                 " CtrSignificance&#34 ;,                 " CustomerDescriptiveName&#34 ;,                 " CvrSignificance&#34 ;,                 "日期&#34 ;,                 " DAYOFWEEK&#34 ;,                 "装置&#34 ;,                 " EXTERNALCUSTOMERID&#34 ;,                 " FinalAppUrls&#34 ;,                 " FinalMobileUrls&#34 ;,                 " FinalUrls&#34 ;,                 "有firstPageCpc&#34 ;,                 "标识&#34 ;,                 " ImpressionAssistedConversions&#34 ;,                 " ImpressionAssistedConversionsOverLastClickConversions&#34 ;,                 " ImpressionAssistedConversionValue&#34 ;,                 "曝光&#34 ;,                 " ImpressionSignificance&#34 ;,                 " IsNegative&#34 ;,                 " KeywordMatchType&#34 ;,                 " LabelIds&#34 ;,                 "标签&#34 ;,                 "月&#34 ;,                 " MonthOfYear&#34 ;,                 " PlacementUrl&#34 ;,                 " PositionSignificance&#34 ;,                 " PrimaryCompanyName&#34 ;,                 "的QualityScore&#34 ;,                 "季度&#34 ;,                 " SearchExactMatchImpressionShare&#34 ;,                 " SearchImpressionShare&#34 ;,                 " SearchRankLostImpressionShare&#34 ;,                 "插槽&#34 ;,                 " TrackingUrlTemplate&#34 ;,                 " UrlCustomParameters&#34 ;,                 " ValuePerConversion&#34 ;,                 " ValuePerConversionManyPerClick&#34 ;,                 "位viewThroughConversions&#34 ;,                 "周&#34 ;,                 "年份"

    };
 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(); //The id from ads.properties file
    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(); //Skip the first line of column names
                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);
                //We have to do this as we have to filter out the mcc id. An exception is thrown by MCC id
                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();
        }
    }
}

`

您在下面的评论中提及的所有列均未使用。

3 个答案:

答案 0 :(得分:2)

请查看以下文档。 https://developers.google.com/adwords/api/docs/appendix/reports/keywords-performance-report#activeviewcpm

对于某些字段&#34;与以下字段不兼容&#34;提供选项。单击该选项以检查不兼容的组合

答案 1 :(得分:0)

v201409中的Keywords Performance Report无法选择以下列:

AssistClicksOverLastClicks
Bounces
ClickAssistedConversionValueLong
ClickAssistedConversionValueNonMoney
ImpressionAssistedConversionValueLong
ImpressionAssistedConversionValueNonMoney
LastClickConversions
LastClicks
NewVisitors
Pageviews
VisitDuration
Visits

建议您尝试删除它们并再试一次。如果做不到这一点,请发布一些代码,以便我们了解您是如何进行通话的。

为了便于日后参考,AdWords Ad Hoc Reporting文档为列出允许的指标,属性和细分的每种报告类型提供了downloadable CSV file

答案 2 :(得分:0)

我和你有同样的问题。根据我的理解,到目前为止,还没有用于确定哪些列组合在adwords中有效的API。 因此,在通过请求真正的AWQL下载文件之前,我会检查组合是否有效。

如果虚拟AWQL返回错误,例如Adwords: Reporting Error: HTTP code: 400, error type: 'ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT', trigger: 'Cannot select a combination of ActiveViewCpm and ConversionCategoryName,ConversionTrackerId,ConversionTypeName', field path: 'ActiveViewCpm',则我通过反复试验使用错误详细信息来修改列的组合。

我不知道这是不是最好的方法......