Thanks,
Russ
//----------------------------------- // Merge Labels from Multiple Campaigns // Created By: Russ Savage // FreeAdWordsScripts.com //----------------------------------- var DESTINATION_CAMPAIGN_NAME = "Destination Campaign Name"; var ORIGIN_CAMPAIGN_NAMES = ["Origin Campaign Name 1","Origin Campaign Name 2"]; function main() { var label_iter = AdWordsApp.labels().get(); while(label_iter.hasNext()) { var label = label_iter.next(); //Pre-build all the iterators var iters = [ label.campaigns().withCondition("Name IN ['"+ORIGIN_CAMPAIGN_NAMES.join("','")+"']").get(), label.adGroups().withCondition("CampaignName IN ['"+ORIGIN_CAMPAIGN_NAMES.join("','")+"']").get(), label.ads().withCondition("CampaignName IN ['"+ORIGIN_CAMPAIGN_NAMES.join("','")+"']").get(), label.keywords().withCondition("CampaignName IN ['"+ORIGIN_CAMPAIGN_NAMES.join("','")+"']").get() ]; for(var i in iters) { var iter = iters[i]; while(iter.hasNext()) { _copyLabels(iter.next()); } } } } //Copies the labels from entity in Origin campaign //to entity with the same name in dest campaign function _copyLabels(entity) { var iter; if(_getEntityType(entity) == "Campaign") { // it's a campaign iter = AdWordsApp.campaigns() .withCondition("Name = '"+DESTINATION_CAMPAIGN_NAME+"'") .get(); } else if(_getEntityType(entity) == "AdGroup") { // it's an adgroup iter = AdWordsApp.adGroups() .withCondition("CampaignName = '"+DESTINATION_CAMPAIGN_NAME+"'") .withCondition("Name = '"+entity.getName()+"'") .get(); } else if(_getEntityType(entity) == "Ad") { // it's an ad iter = AdWordsApp.ads() .withCondition("CampaignName = '"+DESTINATION_CAMPAIGN_NAME+"'") .withCondition("AdGroupName = '"+entity.getAdGroup().getName()+"'") .withCondition("Headline = '"+entity.getHeadline()+"'") .withCondition("Description1 = '"+entity.getDescription1()+"'") .withCondition("Description2 = '"+entity.getDescription2()+"'") .withCondition("DisplayUrl = '"+entity.getDisplayUrl()+"'") .get(); } else if(_getEntityType(entity) == "Keyword") { // it's a keyword iter = AdWordsApp.keywords() .withCondition("CampaignName = '"+DESTINATION_CAMPAIGN_NAME+"'") .withCondition("AdGroupName = '"+entity.getAdGroup().getName()+"'") .withCondition("Text = '"+entity.getText()+"'") .withCondition("KeywordMatchType = '"+entity.getMatchType()+"'") .get(); } while(iter.hasNext()) { _copyLabelsHelper(entity,iter.next()); } } //Copy the labels form orig entity to dest entity function _copyLabelsHelper(orig,dest) { var label_iter = orig.labels().get(); while(label_iter.hasNext()) { dest.applyLabel(label_iter.next().getName()); } } //Returns a text representation of an entity //For a better way, check: http://goo.gl/kZL3X function _getEntityType(obj) { if(typeof(obj['getCampaign']) == "undefined") { return 'Campaign'; } if(typeof(obj['getAdGroup']) == "undefined") { return 'AdGroup'; } if(typeof(obj['getHeadline']) != "undefined") { return "Ad"; } if(typeof(obj['getText']) != "undefined") { return "Keyword"; } return null; }
Really nice information you had provided here. And i wanna appreciate within this. Thank you for providing this information. Seeking for the high-end adhesive labels then, you can visit on direct thermal labels Australia
ReplyDeleteGonna use this script for my blog page if you do not mind.
ReplyDeleteThere are academic nursing writing help companies whose ultimate goal is to provide Help with Nursing Writing Services since they are aware most nursing essay writing service part-time students lack enough time to complete their college custom nursing assignments.
ReplyDeleteThe particular cleanliness of one's commercial space is important to the particular success of one's business. Customers won’t sell to a business that looks dirty and also grimy as they're signs of your questionable business. Since you might be busy emphasizing your enterprise, you may possibly not have time to help keep the area clean. A remedy is business office cleaning companies. maid services dubai
ReplyDeletePsychology coursework writing services are essential and they have become very popular for those seeking psychology research writing help services since most of them seek Psychology Research Writing Services.
ReplyDeletetanx foг tаking the time to explore tһis, It’s ѵery helpful for me
ReplyDeleteدانلود سریال قورباغه دانلود سریال قورباغه دانلود سریال قورباغه دانلود سریال قورباغه دانلود سریال قورباغه
We have been offering high quality Arabic Calligraphy in Dubai, we have high resolution Canvas Printing & Wall Art Printing in Dubai that can be stars of your wall.
ReplyDeleteElectra has been partnered with renowned lighting, ventilation, wiring accessories, home automation dubai and electrical system manufacturers since 1965.
ReplyDelete