Monday, November 26, 2012

Update Ads for the New Year

This is a companion to one of my earlier posts about updating your keywords for the new year.  You can easily run through each ad you have and update them all for the new year using the script below.  It will also pause the old ad as well, making sure your staying relevant to your customers.  You should schedule this to run every year on January 1st if your advertising relies heavily on dated traffic.


// Update Ads for 2012
// Created By: Russ Savage
function main() {
  var OLD_YEAR = "2011";
  var NEW_YEAR = "2012";
  //You probably shouldn't update destination urls unless you know what you are doing.
  var FIELDS_CONTAINING_YEAR = ["Headline","Description1",
    var field_iter =
        .withCondition(FIELDS_CONTAINING_YEAR[i] + " CONTAINS " + OLD_YEAR)
        .withCondition("Status = ENABLED")

  // Private Helper Functions
  function _iterateThroughAds(ad_iter) {
    while (ad_iter.hasNext()) {
      var ad =;
      var ag = ad.getAdGroup();
  function _createNewAdFromOldAd(adgroup, old_ad) {
    //get the updated ad texts replacing all the old years with the new years
    var new_headline = old_ad.getHeadline().replace(OLD_YEAR,NEW_YEAR);
    var new_desc1 = old_ad.getDescription1().replace(OLD_YEAR,NEW_YEAR);
    var new_desc2 = old_ad.getDescription2().replace(OLD_YEAR,NEW_YEAR);
    var new_display_url = old_ad.getDisplayUrl().replace(OLD_YEAR,NEW_YEAR);
    var new_dest_url = old_ad.getDestinationUrl();/*.replace(OLD_YEAR,NEW_YEAR);*/
    //now create the new ad and pause the old one.


  1. Yes, I can show you how to write an essay about yourself. Just have a peek here

  2. Psychology Coursework Writing Services has become a significant challenge owing to the complexity of Psychology Research Writing Services and in other cases lack of time and knowledge needed to prepare Online Psychology Assignment Writing Services .

  3. Engineering assignment writing services are essential for college & university engineering research paper services seekers and Engineering Writing Services.


  4. Wonderful information! I found amazing information on the blogs i suggest everyone to follow the links below to get download files from this website.

  5. Nice post. I learn something totally new and challenging on websites I stumble upon every day. It's always useful to read through articles from other authors and practice something from other sites.also try this WhatsApp Plus Apk.

  6. This is pretty informative. You can also check this messaging app mod that I found :

  7. Download thoptv for pc download – Latest version – Free for Android and watch the latest films and tv shows for free! Enjoy unlimited streaming now in this awesome app!

  8. It is important for neurobiology coursework writing help seekers to find the best Neurobiology Writing Services from a reputable neurobiology research paper writing service provider for their custom neurobiology essay writing services.