Hi,
So I want to put labels on my ads.. I have a lot of ads so manual is not a good solution for me.
I tried using a script I found from the net and it was not very successful.
function main() {// Applies labels to specified ads, based on a Google Doc Spreadsheet.// From http://white.net/blog/label-keywords-ads-bulk-adwords-script//Change this to your spreadsheet's URL!var spreadsheetUrl = "https://docs.google.com/spreadsheets/d/1-eH8OS0vVxUrs0r9NtEDoUKeWG21JjX1vD-VfK7TVpo/edit#gid=0";var inputSheet = SpreadsheetApp.openByUrl(spreadsheetUrl).getActiveSheet(); //The sheet in the Google Docvar i = 2; //Integer for the loopvar numberOfLabels = inputSheet.getLastRow() //Number of rows in the sheet, which is the number of ad groups that want to be labeledvar lastLabelApplied = ""; //Records the label that was last applied, so if the next label is the same the Script knows it doesn't have to create it againwhile (i <= numberOfLabels) //This loops through all the rows{if (inputSheet.getRange("I"+i).getValue() == "") //If there are no notes for the current row{var labelCampaignName = inputSheet.getRange("A" + i).getValue();var labelAdGroupName = inputSheet.getRange("B" + i).getValue();var labelHeadline = inputSheet.getRange("C" + i).getValue();var labelDescriptionLine1 = inputSheet.getRange("D" + i).getValue();var labelDescriptionLine2 = inputSheet.getRange("E" + i).getValue();var labelDisplayURL = inputSheet.getRange("F" + i).getValue();var labelDestinationURL = inputSheet.getRange("G" + i).getValue();var labelText = inputSheet.getRange("H" + i).getValue();var printToSpreadsheet = "-"//This is a variable that records what will be noted in the spreadsheet for each ad group (whether the label has been added, or there was an error)var adIterator = AdWordsApp.ads() //Finds the ads with the specified name and campaign name.withCondition("CampaignName = '" + labelCampaignName + "'").withCondition("AdGroupName = '" + labelAdGroupName +"'").withCondition("Headline = '" + labelHeadline +"'").withCondition("Description1 = '" + labelDescriptionLine1 +"'").withCondition("Description2 = '" + labelDescriptionLine2 +"'").withCondition("DisplayUrl = '" + labelDisplayURL +"'").withCondition("DestinationUrl = '" + labelDestinationURL +"'").get();if (adIterator.hasNext()) //If there is a keyword then the label will be applied{var ad = adIterator.next();if (labelText != lastLabelApplied)//If this label isn't the same as the last label to be applied, then the label is created.//If the label was the same as the last label to be applied we know the label already exists, so we can skip this{AdWordsApp.createLabel(labelText); //Creates the label - if the label already exists then there may be an error, but the Script will continue}ad.applyLabel(labelText); //Applies the label to the keywordprintToSpreadsheet = "Done";lastLabelApplied = labelText; //Records the last applied label}else{//This means the keyword iterator was empty, so there wasn't a keyword of the right name (or a campaign or a group of the right name).printToSpreadsheet = "Ad not found"; //An error message will be recorded in the spreadsheet.}inputSheet.getRange("I" + i).setValue(printToSpreadsheet); //Writes into the Notes column in the spreadsheetLogger.log("Label " + labelText + " applied to '" + labelHeadline + "' in '" + labelAdGroupName + "', '"+ labelCampaignName +"': " + printToSpreadsheet); //Also writes into the Log}//End 'if there are notes'i = i+1;}//End while loop}
This is the result I am getting
https://lh4.googleusercontent.com/-7FmryFnLj04/VNHYq5LzuxI/AAAAAAAAAAU/1pnZeyIkvsM/s1600/ad%2Blabel%2Btest.JPGAll ad labels are added from 1 - 19 but from 20 and beyond I am getting this "ad not found" note
Checking the campaign, adgroups and ads, it is all correct and I just don't understand why this is happening.
Do I need to change something on the script?
I found that script here
{
http://white.net/blog/label-keywords-ads-bulk-adwords-script/}