The script must define exactly one main function.Dismiss

258 views
Skip to first unread message

SEM Site Strategics

unread,
Jan 10, 2017, 9:05:04 AM1/10/17
to AdWords Scripts Forum
What does it mean when I get this error code? How do I fix it?

 
The script must define exactly one main function.
Dismiss

Thanks!, Jennifer

Tyler Sidell (AdWords Scripts Team)

unread,
Jan 10, 2017, 9:25:12 AM1/10/17
to AdWords Scripts Forum
Hi Jennifer,

Each script needs a main function.  So what I mean by that is you need one function called main that has code.  For example:

function main() {
 
var agIterator = AdWordsApp.adGroups().get();
 
 
while (agIterator.hasNext()) {
   
var ag = agIterator.next();
   
Logger.log("Ad Group Name : " + ag.getName());
 
}
}

Thanks,
Tyler Sidell
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages