Saturday, November 30, 2013

AdWords Account Audit Checklist Using AdWords Scripts

I was browsing through some old WordStream blog posts and noticed this one from Phil Kowalski about an AdWords Account Audit Checklist. It seemed like most of that work could be automated using AdWords scripts so I figured I'd give it a shot.

The following script runs through as many of the checks as possible and tries to report areas to check out first. This would be useful for making sure that an account you take over has at least the basics going for it.

To see the results, run the script in your account, then click on the "View details" link and hit the "Logs" button. You should see all the warnings that the script found. Try it out and let me know what additional checks you might add.

Thanks,
Russ

/************************************
* AdWords Account Audit Checklist
* Version 1.1
* ChangeLog v1.1 - Fixed issue with extension selector.
* Based on the blog post by Phil Kowalski
* http://www.wordstream.com/blog/ws/2013/07/02/adwords-account-audit-checklist
* Created By: Russ Savage
* FreeAdWordsScripts.com
************************************/
function main() {
  //1. Campaigns
  //  a. Target the right locations
  var includedLocList = ['United States','Canada']; // <-- the list of places your campaigns should be targeting
  verifyTargetedLocations(includedLocList);
  
  var excludedLocList = ['Europe']; // <-- the list of places your campaigns should be excluding
  verifyExcludedLocations(excludedLocList);
  
  //  b. Language - Can't be done using scripts yet :(
  //  c. Search vs Display
  verifySearchAndDisplay();
  
  //  d. Check Mobile Strategy
  verifyMobileModifiers();
  
  //2. AdGroups
  //  a. Check for AdGroups with more than 20-30 keywords
  var ADGROUP_SIZE = 25; // <-- this is the max number of keywords you want in an AdGroup
  verifyAdGroupSize(ADGROUP_SIZE);
  
  //  b. Check for topic. Difficult to do with scripts
  //  c. Check for ads
  var NUMBER_OF_ADS = 3; // <-- this is the minimum number of ads in an AdGroup
  verifyAdGroupNumberOfAds(NUMBER_OF_ADS);
  
  //3. Keywords
  //  a. Check for MatchTypes
  printMatchTypes();
  
  //4. Search Queries
  //  This analysis is probably worth it's own script
  
  //5. Other
  //  a. Conversion Tracking
  verifyConversionTracking();
  
  //  b. AdExtensions
  verifyAdExtensions();
}

function verifyConversionTracking() {
  //Assume that if the account has not had a conversion in 7 days, something is wrong.
  var campsWithConversions = AdWordsApp.campaigns()
    .withCondition('Status = ENABLED')
    .forDateRange('LAST_7_DAYS')
    .withCondition('Conversions > 0')
    .get().totalNumEntities();
  if(campsWithConversions == 0) {
    warn('Account is probably missing conversion tracking.');
  }
}

function verifyAdExtensions() {
  var campIter = AdWordsApp.campaigns().withCondition('Status = ENABLED').get();
  while(campIter.hasNext()) {
    var camp = campIter.next();
    var phoneNumExtCount = camp.extensions().phoneNumbers().get().totalNumEntities();
    if(phoneNumExtCount == 0) {
      warn('Campaign: "'+camp.getName()+'" is missing phone number extensions.');
    }
    var siteLinksExtCount = camp.extensions().sitelinks().get().totalNumEntities();
    if(siteLinksExtCount < 6) {
      warn('Campaign: "'+camp.getName()+'" could use more site links. Currently has: '+siteLinksExtCount);
    }
    var mobileAppsExtCount = camp.extensions().mobileApps().get().totalNumEntities();
    if(mobileAppsExtCount == 0) {
      warn('Campaign: "'+camp.getName()+'" is missing mobile apps extension.');
    }
  }
}

function printMatchTypes() {
  var numBroad = AdWordsApp.keywords()
    .withCondition('Status = ENABLED')
    .withCondition('AdGroupStatus = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .withCondition('KeywordMatchType = BROAD')
    .get().totalNumEntities();
  var numPhrase = AdWordsApp.keywords()
    .withCondition('Status = ENABLED')
    .withCondition('AdGroupStatus = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .withCondition('KeywordMatchType = PHRASE')
    .get().totalNumEntities();
  var numExact = AdWordsApp.keywords()
    .withCondition('Status = ENABLED')
    .withCondition('AdGroupStatus = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .withCondition('KeywordMatchType = EXACT')
    .get().totalNumEntities();
  var total = numBroad+numPhrase+numExact;
  var percBroad = Math.round(numBroad/total*100);
  var percPhrase = Math.round(numPhrase/total*100);
  var percExact = Math.round(numExact/total*100);
  info('Out of a total of: '+total+' active keywords in your account:');
  info('\tBroad: '+numBroad+' or '+percBroad+'%');
  info('\tPhrase: '+numPhrase+' or '+percPhrase+'%');
  info('\tExact: '+numExact+' or '+percExact+'%');
}

function verifyAdGroupNumberOfAds(requiredNumberOfAds) {
  var agIter = AdWordsApp.adGroups()
    .withCondition('Status = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .get();
  while(agIter.hasNext()) {
    var ag = agIter.next();
    var adCount = ag.ads().withCondition('Status = ENABLED').get().totalNumEntities();
    if(adCount < requiredNumberOfAds) {
      warn('Campaign: "'+ag.getCampaign().getName()+'" AdGroup: "'+ag.getName()+'" does not have enough ads: '+adCount);
    }
    if(adCount > (requiredNumberOfAds+2)) {
      warn('Campaign: "'+ag.getCampaign().getName()+'" AdGroup: "'+ag.getName()+'" has too many ads: '+adCount);
    }
  }
}

function verifyAdGroupSize(size) {
  var agIter = AdWordsApp.adGroups()
    .withCondition('Status = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .get();
  while(agIter.hasNext()) {
    var ag = agIter.next();
    var kwSize = ag.keywords().withCondition('Status = ENABLED').get().totalNumEntities();
    if(kwSize >= size) {
      warn('Campaign: "'+ag.getCampaign().getName()+'" AdGroup: "'+ag.getName()+'" has too many keywords: '+kwSize);
    }
  }
}

function verifyMobileModifiers() {
  var campIter = AdWordsApp.campaigns().withCondition('Status = ENABLED').get();
  while(campIter.hasNext()) {
    var camp = campIter.next();
    var desktop = camp.targeting().platforms().desktop().get().next();
    //var tablet = camp.targeting().platforms().tablet().get().next();
    var mobile = camp.targeting().platforms().mobile().get().next();
    //check for mobile modifiers
    if(desktop.getBidModifier() == 1 && mobile.getBidModifier() == 1) {
      warn('Campaign: "'+camp.getName()+'" has no mobile modifier set.');
    }
  }
}

function verifyTargetedLocations(locList) {
  var campIter = AdWordsApp.campaigns().withCondition('Status = ENABLED').get();
  while(campIter.hasNext()) {
    var camp = campIter.next();
    var locIter = camp.targeting().targetedLocations().get();
    reportOnLocations(camp,locIter,locList);
  } 
}

function verifyExcludedLocations(locList) {
  var campIter = AdWordsApp.campaigns().withCondition('Status = ENABLED').get();
  while(campIter.hasNext()) {
    var camp = campIter.next();
    var locIter = camp.targeting().excludedLocations().get();
    reportOnLocations(camp,locIter,locList);
  } 
}

function reportOnLocations(camp,locIter,locList) {
  var campLocList = [];
  while(locIter.hasNext()) {
    var loc = locIter.next();
    campLocList.push(loc.getName());
    if(!locList) {
      warn('Campaign: "'+camp.getName()+'" targeting: "'+loc.getName()+'"');
    }
  }
  if(locList && campLocList.sort() != locList.sort()) {
    for(var i in campLocList) {
      if(locList.indexOf(campLocList[i]) == -1) {
        warn('Campaign: "'+camp.getName()+'" incorrectly targeting: "'+campLocList[i]+'"');
      }
    }
    for(var i in locList) {
      if(campLocList.indexOf(locList[i]) == -1) {
        warn('Campaign: "'+camp.getName()+'" not targeting: "'+locList[i]+'"');
      }
    }
  }
}

function verifySearchAndDisplay() {
  var API_VERSION = { includeZeroImpressions : false };
  var cols = ['CampaignId','CampaignName','AdNetworkType1','Impressions'];
  var report = 'CAMPAIGN_PERFORMANCE_REPORT';
  var query = ['select',cols.join(','),'from',report,'during','LAST_30_DAYS'].join(' ');
  var results = {}; // { campId : { agId : [ row, ... ], ... }, ... }
  var reportIter = AdWordsApp.report(query, API_VERSION).rows();
  while(reportIter.hasNext()) {
    var row = reportIter.next();
    if(results[row.CampaignId]) {
      warn('Campaign: "'+row.CampaignName+'" is targeting the Display and Search networks.');
    } else {
      results[row.CampaignId] = row;
    }
  }
  return results;
}

function warn(msg) {
  Logger.log('WARNING: '+msg);
}

function info(msg) {
  Logger.log(msg);
}

14 comments:

  1. Invest in an heirloom to cherish forever with a timepiece from the fake cartier watches collection. A fusion of cutting-edge technology and heritage craftsmanship, replica calibre de cartier carbon diver watchesCartier’s fine watches carry the replica calibre de cartier carbon diver watches prestige of the brand’s illustrious history and exceptional quality.

    ReplyDelete
  2. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. hotmaillogin

    ReplyDelete
  3. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! audit firms in dubai

    ReplyDelete
  4. Thanks for providing recent updates regarding the concern, I look forward to read more. buy 100 instagram likes with paypal

    ReplyDelete
  5. We also enjoy providing b2b email lists to get other countries.The data is authorized by acquiring company information database not only from the united states but All other countries such as Canada, United Kingdom, Australia, Middle East, Singapore, New Zealand, Asia,Europe, Russia and a lot more Nations. The list is strategically segmented into the form of industry, the name of the organization, name of contact person, job title, purchase email lists contact info, the quantity of workers, and sales of their enterprise to mention a couple.
    Our searchable email listing provides you a more specific, yet relevant information to use.Not all email providers have access to each country's database. Using an global email list, you can advertise your business globally without needing to spend lots of money going from 1 nation to another. With true b2b sales leads, it is possible to build your global relationships and could mean expansion of one's business .

    ReplyDelete
  6. Internet Download Manager 6.38 Build 9 IDM Crack Patch with Serial Key download is a kind of shareware download manager owned by an American company called Tonec Inc. IDM Patch Free Download captures any type of download in an impressive time limit and then completes the download in a very short time and at a faster speed as compared to any other download manager at the moment.

    ReplyDelete
  7. I would like to recommend you the best essay writing service reviews with the best list of reviews for writing companies. Here you can read all the information you are interested in, choose the right company and place an order.

    ReplyDelete
  8. PharmEnvee is a global biotechnology and pharmaceutical marketing company that brings targeted products to a global audience. We specialize in utilizing innovative strategies to introduce groundbreaking biotechnology, pharmaceutical agents, and medical devices to market. Our team of marketing consultants and product specialists are dedicated to identifying and, if needed, creating opportunities for our clients’ products to launch and sustain in their targeted marketplaces.

    ReplyDelete
  9. short term rentals in Dubai ae is one-stop destination where you can find fully furnished serviced apartments and book luxury serviced accommodation for long, mid-term and short corporate and non-corporate stays.

    ReplyDelete
  10. We are the most trusted online loan search and loan advice site in South Africa. friendlyfinance.co.za Find a lender in just a few minutes. Apply today!

    ReplyDelete
  11. "Archie 420 Dispensary welcome anyone 21+ to stop by and have a one of a kind Marijuana experience with us.
    No trip to the Evergreen state is complete without a visit to archie 420 Marijuana dispensary.
    Also, you can Check out Midweek specials: Buy marijuana from USA $2 off ANY pre-roll Tuesday and $2 off ANY 1 gram Wednesday! We accept variety forms of payments.
    The Archie's do strive to provide a broad range of quality Marijuana products to fit any budget!
    Archie's are conveniently located at our main office: 380 Quivas St, Denver CO, 80223, USA and 45 Lisbon st San Francisco California 94112 USA and.. Branch Unit in 2300 Windy Ridge Pkwy SE - Atlanta GA ,USA
    Archie 420 menu include all taxes, menu is subject to change and Items do sell very quickly.
    Finally, no Medical card is required. As a result, come to Archie's online shop and experience modern age of truly legalized marijuana and we offer a variety of strains to satisfy the most discerning of consumers. We are open 24/7 and you are always welcome."

    ReplyDelete
  12. Crystal online pharmacy is a trusted online drug store with a wide range of products to suit the needs of ther clients. Crystal Pharmacy do strive to offer the best service and ship products world wide. All the products listed on their website are Available in stock. Buy CLA online Expect your order to be processed Immediately when you send your request. They deal with varieties of drugs for customers satisfaction. They also cross barriers with their products and struggle hard to meet human satisfaction. When shopping with them, Be safe and secured and you will realize how swift they are with our services.

    ReplyDelete
  13. Testimonial Review of Taskade, Taskade Reviews the all-in-one collaboration platform for remote teams. Unleash your team productivity with task lists, mindmaps, and video chat.

    ReplyDelete