有没有办法在Google App脚本中访问Adwords?

问题描述 投票:0回答:2

我创建了一个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 App Scripts中运行Adwords脚本,因为GAS可以作为webapps发布,以便我可以根据需要为Adwords脚本提供一些值。

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

ReferenceError: "AdWordsApp" is not defined.

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

google-apps-script google-adwords
2个回答
1
投票

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

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

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


0
投票

看来你可以通过外部API,并使用OAuth库进行连接(已作为库包含在谷歌应用程序脚本中):

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

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

© www.soinside.com 2019 - 2024. All rights reserved.