scripting - AdWords JavaScript: Get a function to look at a specific account passed from MCC level -
the problem have getting campaignselector() function ‘look’ @ account has been passed through accountiterator() function.
i feel i'm either quite close or have wrong end of stick completely.
very little scripting experience apologies ignorance!
//this code placed in mcc, sift through accounts //in mcc fit criteria //then in selected accounts, sift through campaigns //that fit criteria , add //these report (report code yet added) function main() { var mccaccount = adwordsapp.currentaccount(); var childaccounts = mccapp.accounts(); function accountiterator() { var accountselector = mccapp.accounts() .withcondition("accountdescriptivename contains 'xxx'") .withcondition("status = enabled"); var accountiterator = accountselector.get(); while (accountiterator.hasnext()) { var account = accountiterator.next(); var accountname = account.getname(); logger.log(accountname); campaignselector(accountname); //this might wrong.... //need pass account name through campaignselector function //so campaignselector functions looks @ campaigns in //highlighted account } } function campaignselector () { //select campaigns we're interested in var account = adwordsapp.currentaccount(); //guessing might need use this? var campaignselector = adwordsapp.campaigns() .withcondition("campaignname contains 'xxx'") .withcondition("searchexactmatchimpressionshare < 95") .fordaterange("last_7_days") .withcondition("status = enabled"); //get iterator list selected campaigns var campaigniterator = campaignselector.get(); //iterate through selected campaigns while (campaigniterator.hasnext()) { var campaign = campaigniterator.next(); //add campaign , account info report – coded seperately } } }
Comments
Post a Comment