Skip to content

Instantly share code, notes, and snippets.

@derekmartinla
Last active November 24, 2016 16:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save derekmartinla/46bbbcd2e800111fd46f to your computer and use it in GitHub Desktop.
Save derekmartinla/46bbbcd2e800111fd46f to your computer and use it in GitHub Desktop.
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