【发布时间】: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