Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Copy Existing AdWords Ads With A New Destination URL
function main() {
// change the CampaignName condition to whatever suits you
var adIter = AdWordsApp.ads().withCondition("CampaignName contains WP").withCondition("Status = ENABLED").get();
while(adIter.hasNext()) {
var ad = adIter.next();
var headline = ad.getHeadline();
var d1 = ad.getDescription1()
var d2 = ad.getDescription2();
var displayUrl = ad.getDisplayUrl();
var dest = "http://your-url-here.com/";
var camp = ad.getCampaign();
var adgroup = ad.getAdGroup();
var newAd = adgroup.newTextAdBuilder()
.withHeadline(headline)
.withDescription1(d1)
.withDescription2(d2)
.withDisplayUrl(displayUrl)
.withDestinationUrl(dest)
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment