[英]Is there a way to access the Adwords in Google App Scripts?
我创建了一个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脚本中运行Adwords脚本,因为GAS可以作为webapp发布,因此我可以根据需要为Adwords脚本提供一些值。
我收到以下错误消息,因为在GAS中无法访问AdwordsApp。 因此,有一种方法可以使用App脚本与Adwords脚本进行通信。
ReferenceError: "AdWordsApp" is not defined.
我的要求是通过吸收用户的输入来制作视频广告。 因此,我没有找到任何Adwords API详细信息,所以我想使用AdwordsScript通过从外部获取一些参数(名称,video_url等)来创建视频广告。
并非以任何官方方式。 没有REST API,客户端库仅适用于少数几种语言。 GAS不是其中之一。 我只能为Node找到此NPM软件包:
https://www.npmjs.com/package/adwords-api
当然,这不适用于Apps Script,因此您必须重写代码。
看来您可以通过外部API并使用OAuth库进行连接(已经作为库包含在Google Apps脚本中):
https://developers.google.com/apps-script/guides/services/external
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.