Forked from derekmartinla/gist:46bbbcd2e800111fd46f
Created
December 10, 2015 01:19
-
-
Save timelf123/a61a1088830fcbb2b431 to your computer and use it in GitHub Desktop.
Copy Existing AdWords Ads With A New Destination URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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