【问题标题】:Adwords API: Select Ads with empty impressionAdwords API:选择展示为空的广告
【发布时间】:2014-05-21 16:09:43
【问题描述】:

经过几天的痛苦和磨难,我设法理解了文档要说的内容,并连接到 Adwords API,然后在疯狂的匆忙中,我什至设法从中获取了一些数据。我自欺欺人,我以为我有它,直到我不得不得到一些带有 where 子句的广告。

我现在的最终目标只是获取所有展示次数为 0 的广告。

我已经查看了java code examples 和许多 SO 帖子,当然我也查看了 Adwords documentation 并且找不到我想要的内容。最后一个有“AdGroupAdService: Create, update, and delete ads”,据我了解这是我应该使用的服务,我的(Scala)代码如下所示:

val adwordsCredentials = new OfflineCredentials.Builder().forApi(Api.ADWORDS).fromFile().build().generateCredential()
val adwordsSession = new AdWordsSession.Builder().fromFile().withOAuth2Credential(adwordsCredentials).build()
val adgroupService = new AdWordsServices().get(adwordsSession, classOf[AdGroupAdServiceInterface])

def getAds() = {
  val builder = new SelectorBuilder()
  val selector = builder
    .fields("Id", "Name", "Status", "AdGroupId")
    .offset(0)
    .limit(100)
    .build()

  val results = adgroupService.get(selector)

  if (results.getEntries() != null) {
    results.getEntries().foreach( row => {
      println(row.getAd.getId)
    })
  }
}

1) 没有getAd.getClicksgetAd.getImpressions,我挖掘了Ad.java 类,唯一可用的字段是:

id;
url;
displayUrl;
devicePreference;
adType;

2) 如果我将Clicks 添加到查询中,我会得到faultString: [SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'Clicks'],这可能是因为活动没有Clicks 字段;

3) 报告是这样做的唯一方法吗?

看起来很容易做到,但我找不到方法。

【问题讨论】:

    标签: java scala google-ads-api


    【解决方案1】:

    Google 从其多个 Adwords API 服务(包括 AdGroupAdService)中删除了所有统计字段,并使用 the release of v201309

    您需要使用AD_PERFORMANCE_REPORT。在报表定义的选择器中,设置 predicate 以仅包含 Impressions 字段值为 0 的行。

    【讨论】:

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