Converting Single Account Script => MCC Version (ReferenceError: "AdwordsApp" is not defined.)

605 views
Skip to first unread message

Contevo Clients

unread,
Feb 2, 2016, 8:04:32 PM2/2/16
to AdWords Scripts Forum
I love this script from Russell Savage which statistically calculates the best performing ad within an Ad Group: http://www.freeadwordsscripts.com/2013/12/automated-creative-testing-with.html

I am really trying to move it to the MCC level though, so I can have winner/loser ads determined across all accounts, which hopefully will make it easier to find and write new ads for all accounts much more quickly. 

Is it typically very difficult to get a single account script to work at the MCC level?
At the moment I am getting the following error: 

ReferenceError: "AdwordsApp" is not defined. (line 458)

Any thoughts about how to execute in MCC or where to start would be so appreciated. Have tried changing this to MccApp, but I still thanks that's missing the mark. 
Message has been deleted

Janik M

unread,
Feb 3, 2016, 3:25:23 AM2/3/16
to AdWords Scripts Forum
Hi, you can always get single account scripts to work on mult-client accounts.
You just need to wrap the whole code with an iterator, which runs through all accounts you want to work in. 

You should especially take a look at the "Working on client accounts" part.

Tyler Sidell (AdWords Scripts Team)

unread,
Feb 3, 2016, 10:05:40 AM2/3/16
to AdWords Scripts Forum
Thanks Janik for supplying that information.

@Contevo, please follow the guide and let us know if you have any questions.

Regards,
Tyler Sidell
AdWords Scripts Team

Contevo Clients

unread,
Feb 7, 2016, 12:25:45 AM2/7/16
to AdWords Scripts Forum
Unfortunately no joy figuring our how to wrap the existing script. 
If for example I have my existing function...

function main() {
/*****************
*Existing function
*inside this block
*****************/

}

What would I look to wrap around this if I wanted to process all accounts that had the label 'test'

Can we infact simply wrap the existing code block with a header/footer snippet like the above post suggests, or do we need to alter the main() function??

Tyler Sidell (AdWords Scripts Team)

unread,
Feb 8, 2016, 10:46:23 AM2/8/16
to AdWords Scripts Forum
Hi Contevo,

Essentially, you should be looking at the "Working on Client Accounts" section.  This is all within the main() function.  You would need to set up an iterator that goes through each individual account one-by-one:
var mccAccount = AdWordsApp.currentAccount();
// Select your accounts
...
// Iterate through the list of accounts
while (accountIterator.hasNext()) {
var account = accountIterator.next();
// Select the client account.
MccApp.select(account);
// Select campaigns under the client account
var campaignIterator = AdWordsApp.campaigns().get();
// Operate on client account
...
}
// Switch back to MCC account
MccApp.select(mccAccount);

The code that you want to perform on each account would go underneath "Operate on client account".

Thanks,
Tyler Sidell
AdWords Scripts Team

Contevo Clients

unread,
Feb 8, 2016, 7:37:50 PM2/8/16
to Tyler Sidell (AdWords Scripts Team) via AdWords Scripts Forum
Yes I have read that. It was infact on the page linked above. I kind of got the impression it was as easy as wrapping the existing script, so was perhaps looking for code examples that may fit the above mentioned use case. 

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/32YPD5fDIxo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/9d1baf5c-64e3-4b87-9bfc-c5aaaddd457d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tyler Sidell (AdWords Scripts Team)

unread,
Feb 9, 2016, 9:45:01 AM2/9/16
to AdWords Scripts Forum
Hi Contevo,

If you are still having issues, you can supply us with your CID for your AdWordsApp and MCC accounts (reply privately to the author).  Also, provide us with the script name that you would like to convert into a MCC version.

Thanks,
Tyler Sidell
AdWords Scripts Team

On Monday, February 8, 2016 at 7:37:50 PM UTC-5, Contevo Clients wrote:
Yes I have read that. It was infact on the page linked above. I kind of got the impression it was as easy as wrapping the existing script, so was perhaps looking for code examples that may fit the above mentioned use case. 
Reply all
Reply to author
Forward
0 new messages