0

I manage about 35 Google Ads accounts under an MCC account. We have set up a child account designed to contain all active ads contained in the other child accounts. I'm looking to create a script that will loop through all other child accounts, find the active campaigns >> ad groups >> ads, and copy those ads into our other child account.

I've figured out how to find the active ads, but I'm having a hard time finding documentation on how to copy and paste ads. I should also mention that these are all display ads.

Any ideas?

  var accountIterator = MccApp.accounts().get();

  while (accountIterator.hasNext()) {
    var account = accountIterator.next();
    MccApp.select(account);
    var currAccount = AdWordsApp.currentAccount(account);
    var campaignList = AdWordsApp.campaigns().get();
    while (campaignList.hasNext()) {
      var campaign = campaignList.next();
      var campStatus = campaign.isEnabled();
      var campEnd = new Date(campaign.getEndDate().year, campaign.getEndDate().month, campaign.getEndDate().day, 0, 0, 0, 0);
      if(campStatus == true && campEnd > now){
        var adGroupList = campaign.adGroups().get();
        while (adGroupList.hasNext()) {
          var adGroup = adGroupList.next();
          var adGroupStatus = adGroup.isEnabled();
          var adsList = adGroup.ads().get();
          if(adGroupStatus == true){
            while (adsList.hasNext()) {
              var ad = adsList.next();
              var adStatus = ad.isEnabled();
              if(adStatus == true){
                // THIS IS WHERE I SUSPECT THE ADDITIONAL CODE IS NEEDED
                Logger.log(ad.getEntityType())
              }
            }
          }
        }
      }
    }
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.