【问题标题】:Is there a way to access the Adwords in Google App Scripts?有没有办法访问 Google App Scripts 中的 Adwords?
【发布时间】:2018-04-20 07:13:12
【问题描述】:

我创建了一个 Adwords 脚本并能够在 adwords UI 中运行。

function getCurrentAccountDetails() {
var currentAccount = AdWordsApp.currentAccount();
Logger.log('Customer ID: ' + currentAccount.getCustomerId() +
   ', Currency Code: ' + currentAccount.getCurrencyCode() +
   ', Timezone: ' + currentAccount.getTimeZone());
var stats = currentAccount.getStatsFor('LAST_MONTH');
Logger.log(stats.getClicks() + ' clicks, ' +
   stats.getImpressions() + ' impressions last month');
}

我可以在 Google 应用脚本中运行 Adwords 脚本吗,因为 GAS 可以作为 webapps 发布,这样我就可以根据需要为 Adwords 脚本提供一些值。

我遇到错误是因为在 GAS 中无法访问 AdwordsApp。那么有没有办法使用 App 脚本与 Adwords 脚本进行通信。

ReferenceError: "AdWordsApp" is not defined.

我的要求是通过获取用户的输入来制作视频广告。所以为此我没有找到任何 Adwords API 详细信息,所以我想使用 AdwordsScript 通过从外部获取一些参数(名称、video_url 等)来创建视频广告。

【问题讨论】:

标签: google-apps-script google-ads-api


【解决方案1】:

没有以任何官方方式。没有 REST API,客户端库只存在于少数几种语言。 GAS 不是其中之一。我只能为 Node 找到这个 NPM 包:

https://www.npmjs.com/package/adwords-api

当然,这不适用于 Apps 脚本,因此您必须重写代码。

【讨论】:

  • 此 NPM 包与 Ads API 集成,但 Ads API 不提供执行 Google Ads 脚本的方法。
【解决方案2】:

您似乎可以通过外部 API,并使用 OAuth 库进行连接(已作为库包含在 Google Apps 脚本中):

https://developers.google.com/apps-script/guides/services/external

https://github.com/gsuitedevs/apps-script-oauth2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-04
    • 2017-01-15
    • 1970-01-01
    • 1970-01-01
    • 2014-12-22
    • 2014-09-03
    • 1970-01-01
    相关资源
    最近更新 更多