Home » Php » Multiple Label Names in Google AdWords AdGroup API Script

Multiple Label Names in Google AdWords AdGroup API Script

Posted by: admin October 26, 2017 Leave a comment

Questions:
function main() {
  getAllDataShowing();
}

function getAllDataShowing(){
  var finaldate = SerializeData(Campaign);
  Logger.log(finaldate);

}


function getAllLabels(lable) {
   LableName ='';
  while (lable.hasNext()) {
    var Lables = lable.next();
    LableName = Lables.getName();
  }
  return LableName;
}


function SerializeData(Campaign){

  var GroupData=[];
  for(var i=0;i<=(Campaign.length)-1;i++){
        var adGroups = AdWordsApp.adGroups()
        .withCondition("CampaignName = 'CAMPAIGN_NAME'")
        .get();
       var camName = Campaign[i].Name;
    while(adGroups.hasNext()){
      var getGroups = adGroups.next();
      var label = getAllLabels(camName);

    }
  }
    return GroupData;
}

I want to show multiple labels i.e Label1; Label2; Label3 in my output.

I have run this script into my AdWords account, script is working fine but, the only issue is that I have some AdGroups which have multiple labels assigned, but this script is returning only one label randomly.

Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *