【问题标题】:How to get negative keyword list from a campaing using Google Adwords API如何使用 Google Adwords API 从广告系列中获取否定关键字列表
【发布时间】:2020-10-06 10:53:20
【问题描述】:

当您在 google adwords 中设置广告系列时,您可以向其中添加否定关键字,这样如果包含否定关键字,搜索查询可能与您的广告系列不匹配。

我想提取每个广告系列的否定关键字列表。在文档中我可以find this example:

def retrieve_negative_keywords(report_utils)
  report_definition = {
    :selector => {
      :fields => ['CampaignId', 'Id', 'KeywordMatchType', 'KeywordText']
    },
    :report_name => 'Negative campaign keywords',
    :report_type => 'CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT',
    :download_format => 'CSV',
    :date_range_type => 'TODAY',
    :include_zero_impressions => true
  }

  campaigns = {}

  report = report_utils.download_report(report_definition)
  # Slice off the first row (report name).
  report.slice!(0..report.index("\n"))

  CSV.parse(report, { :headers => true }) do |row|
    campaign_id = row['Campaign ID']

    # Ignore totals row.
    if row[0] != 'Total'
      campaigns[campaign_id] ||= Campaign.new(campaign_id)
      negative = Negative.from_csv_row(row)
      campaigns[campaign_id].negatives << negative
    end
  end

  return campaigns
end

它是用 Ruby 编写的,并且没有用于此任务的 Python 示例。还有a report for the negative keywords,但它没有指标,我不能用它来检索每个广告系列的否定关键字列表。

我正在使用这个结构来查询数据库:

report_query = (adwords.ReportQueryBuilder()
                        .Select('CampaignId', 'Id', 'KeywordMatchType', 'KeywordText')
                        .From('CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT')
                        .During('LAST_7_DAYS')
                        .Build())

但是查询它会报错:

googleads.errors.AdWordsReportBadRequestError:类型:QueryError.DURING_CLAUSE_REQUIRES_DATE_COLUMN

当我添加 Date 时,它会抛出同样的错误。

是否有人能够使用 Python 和 Google Adwords API 报告提取每个广告系列的否定关键字列表?

【问题讨论】:

    标签: python google-ads-api google-reporting-api


    【解决方案1】:

    查询CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT 时不能使用DURING 子句,因为该报告是structure report,这意味着它不包含统计信息。如果您删除 During() 电话并执行此操作

    report_query = (googleads.adwords.ReportQueryBuilder()
                    .Select('CampaignId', 'Id', 'KeywordMatchType', 'Criteria')
                    .From('CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT')
                    .Build())
    

    您将获得每个广告系列所有否定关键字的列表。

    如果您考虑一下,这是有道理的 - 否定关键字阻止您的广告被展示,因此印象或点击等指标将毫无意义。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多