Friday, November 23, 2012

Automatically Pause Ads with Low CTR

Recently, Brad over at CertifiedKnowledge.com published some tips about testing at scale.  One of the most common testing techniques he mentions is to create a ton of ads and let Google optimize the rotation for you.  The problem with this technique is that the losers are rarely deleted.  Well, using the script below, you can find the worst performing ads in all your adgroups and pause it (if there is at least one other ad in the adgroup).

Thanks,
Russ


//-----------------------------------
// Pause Ads with Low CTR
// Created By: Russ Savage
// FreeAdWordsScripts.com
//-----------------------------------
function main() {
  // Let's start by getting all of the adGroups that are active
  var ag_iter = AdWordsApp.adGroups()
  .withCondition("Status = ENABLED")
  .get();

  // Then we will go through each one
  while (ag_iter.hasNext()) {
    var ag = ag_iter.next();
    var ad_iter = ag.ads()
      .withCondition("Status = ENABLED")
      .forDateRange("ALL_TIME")
      .orderBy("Ctr DESC")
      .get();
    var ad_array = new Array();
    while(ad_iter.hasNext()) {
      ad_array.push(ad_iter.next());
    }
    if(ad_array.length > 1) {
      for(var i = 1; i < ad_array.length; i++) {
        ad_array[i].pause(); //or .remove(); to delete them 
      }
    }
  }
}

36 comments:

  1. would this be ads with impressions?

    ReplyDelete
  2. Great help. Thank you Russell

    Could you please help me to apply this condition (pausing ads with low CTR) in certain campaigns?

    I'm following naming convention for campaigns to differentiate "Search" and "Display" network. A "Search" campaign name will contain a string "SR" and "Display campaign name will contain a string "DP".

    I would like to apply the above script condition only for "Search" (SR) campaign's Ad Groups. Thanks in Advance.

    Thanks,
    Ren

    ReplyDelete
    Replies
    1. Hi Renjith, In order to do that, all you need to do is add an additional .withCondition() to the selector on lines 8 - 10.

      var ag_iter = AdWordsApp.adGroups()
      .withCondition("Status = ENABLED")
      .withCondition("CampaignName CONTAINS 'SR'")
      .get();

      You can use CONTAINS or CONTAINS_IGNORE_CASE. More info can be found here: AdGroupSelector withCondition().

      Thanks,
      Russ

      Delete
    2. Great Article
      Cloud Computing Projects


      Networking Projects

      Final Year Projects for CSE


      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  3. Thank you very much Russel. Your guidance is a great help for many individuals like me.

    Thanks,
    Ren

    ReplyDelete
  4. Hi Russell,

    Thank you for your help, we have used several of your scripts and they have been very helpful.

    I was curious, is there a way to use this script to only pause one ad? It looks like this script pauses all of the ads in the adgroup besides the highest performing one.

    Thank you! :)

    ReplyDelete
    Replies
    1. Hi Becca, Pausing just one ad is easy enough. I am assuming you only want to pause the lowest performing ad in the adgroup.

      First, you want to make sure the ads are returned so that the first result is the worst performer. So on line 18, you want to change DESC to ASC (for ascending). You could also put a .limit(1) on there as well since you only care about 1 result.

      Next, you can replace lines 20 - 28 with this much more simple logic:

      if(ad_iter.hasNext()) {
      ad_iter.next().pause();
      }

      That should do it. Thanks for reading and please let me know if you have any other questions.

      ~Russ

      Delete
    2. Instead of .limit(1), it should be .withLimit(1).

      Delete
  5. Hi Russell,

    This is exactly what i'm looking for!

    I too just need to pause the lowest performing ad in terms of CTR for each ad group in the account.

    I've done the following:

    function main() {
    // Let's start by getting all of the adGroups that are active
    var ag_iter = AdWordsApp.adGroups()
    .withCondition("Status = ENABLED")
    .get();

    // Then we will go through each one
    while (ag_iter.hasNext()) {
    var ag = ag_iter.next();
    var ad_iter = ag.ads()
    .withCondition("Status = ENABLED")
    .forDateRange("ALL_TIME")
    .orderBy("Ctr ASC")
    .limit(1)
    .get();
    if(ad_iter.hasNext()) {
    ad_iter.next().pause();
    }
    }
    }

    However, I'm getting the following error 'TypeError: Cannot find function limit in object [AdSelector]. (line 15)'

    I'm not clued up at all on this so any help would be much appreciated.

    Thanks,

    Matt

    ReplyDelete
    Replies
    1. Hi Matt, My apologies. Instead of .limit(1), it should be .withLimit(1).

      Thanks,
      Russ

      Delete
    2. Thanks a lot Russ - that's worked a treat!

      Great blog - saved me a lot of time spent on manual tasks and problem solving.

      Cheers,

      Matt

      Delete
  6. Instead of CTR can we pause ads with lower conversions or higher cpa?

    ReplyDelete
  7. I do not know if it still work with mine. I'll check this later in my desktop and try it here occupied stagers san jose

    ReplyDelete
  8. McAfee gives McAfee activate by which you can install McAfee antivirus which protects your data if you want to visit our website McAfee activate you can visit our website McAfee account login our team will provide you complete support our team is 24*7 available.

    ReplyDelete
  9. The term "low-code app development" didn't exist until a few years ago but the concept isn't a new one. business users who see an opportunity to optimize a process and take it upon themselves to create their own apps. Rather than spend the time and manual effort to code an app from scratch that is made up of common features and components, low code development platforms let the developers work from existing templates and drag prebuilt elements, forms, and objects together to get a particular department or team the simple working app they need with a lot less hassle.

    ReplyDelete
  10. When you use a genuine service, you will be able to provide instructions, share materials and choose the formatting style. การตลาดออนไลน์

    ReplyDelete
  11. When students seek our Online Nursing Case Study Writing Services from us, they are assured to receive the best Nursing Case Study Help Services that meets all their writing needs and Nursing Research Paper Services that has been written following all the instructions.

    ReplyDelete
  12. i am browsing this website dailly , and get nice facts from here all the time .

    ReplyDelete
  13. Those seeking education assignment writing services have an advantage of hiring online education assignment writers who are familiar with research papers on teaching & education for their Online Education Assignment Help.

    ReplyDelete
  14. good info www.androidcoding.in

    ReplyDelete
  15. Purchase healthcare research paper services and healthcare coursework writing services since students find help when they visit Healthcare Essay Writing Services.

    ReplyDelete
  16. Thank you sharing. keep writing and sharing.
    find here helpful info for grocery startup: Grocery App Development

    ReplyDelete
  17. Proper and Excellent content Thanks for sharing keep it. Visit Our lovely Life Time Pharmacy Secure Store
    Adderall 30mg for sale | 30mg Oxycodone near you | buy Oxycontin online 80mg in USA secure

    ReplyDelete
  18. Super Dj Remix Song New Latest Song Available On This Website,

    Good Job Sir

    Latest Official Song Download Now Click Here

    Download Now Click Here

    ReplyDelete
  19. Many people were facing problems regarding pause ads with low ctr but now they are satisfied because they have solved their issues and getting benefits from ads. Coursework writing services.

    ReplyDelete
  20. You can refresh Garmin maps utilizing the Garmin Map install programming which allows you to download and introduce the most recent Garmin maps on your gadget.

    ReplyDelete

  21. Mediator Łódź
    Adwokat Łódź




    Gilotyna
    Lutownica transformatorowa
    Gilotyna
    Taxi Zgierz
    <a href="http://przemyslawbuda.pl>Mechanik Łódź </a>

    http://zdz-lodz.pl

    http://zdz-lodz.site

    http://przemyslawbuda.pl

    http://taxi-zgierz.pl

    ReplyDelete
  22. Psychology coursework writing services are not hard to come across for those in need of Psychology Research Paper Services and psychology assignment writing services.

    ReplyDelete
  23. Nice post. Thank you to provide us this useful information. Black Widow Leather Jacket

    ReplyDelete
  24. Thanks for posting this info. I just want to let you know that I just check out your site.
    rocketeer jacket

    ReplyDelete
  25. Hi Russell,

    Is there a way to pause ads or get an alert if an ad_id reaches a certain amount spent with 0 conversions?

    ReplyDelete
  26. Hello... Thanks for the sharing your article with us... I hope your next article coming out soon.
    Best Holiday Music Album
    Christmas 2020 Songs

    ReplyDelete
  27. Finding the social psychology coursework writing services and Social Psychology Writing Services is not easy unless one is keen to establish a reputable social psychology assignment writing service provider & social psychology research writing services.

    ReplyDelete