简体   繁体   中英

Is there a way to access the Adwords in Google App Scripts?

I have created a Adwords Script and able to run in 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');
}

Can I run Adwords scripts in Google App Scripts, since GAS can be published as webapps so that I can give some values on demand to the Adwords Script.

I am getting below error because in GAS no access to AdwordsApp. So is there a way to communicate to Adwords Scripts using App scripts.

ReferenceError: "AdWordsApp" is not defined.

My Requirement is to create video ads by taking inputs from the user. So for this I didn't found any Adwords API details, so I want to use AdwordsScript to create video ads by taking some parameters( name, video_url etc) from the outside.

Not in any official way. There's no REST API and client libraries only exist for a handful of languages. GAS is not one of them. I was only able to find this NPM package for Node:

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

Of course, this won't work with Apps Script, so you'll have to rewrite the code.

it seems you can through external API, and using OAuth libraries to connect (already included as libraries in google apps script):

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM