簡體   English   中英

有什么方法可以訪問Google App腳本中的Adwords?

[英]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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM