Automating AdWords as much as possible is every advertiser’s dream, especially when dealing with the massive accounts we see in enterprise-level SEM. This article provides a few examples of how we at Top Tier Marketing have automated some of the more laborious tasks of running AdWords.

Hopefully, these examples will give you some ideas for your own accounts. There’s even a full script that should work by simply copying it into your own account toward the end of this post. 

Automate AdWords Ad Creation From Your Catalog

Create AdWords Ads From Product Catalog

Flow for using your product database to create AdWords ads.

When the list of things you want to advertise is constantly changing, automating the creation of new ads and keywords can save you a lot of time, which you can then use to focus on higher value tasks.

Automatically created ads and keywords can run the spectrum from using one super simple template to hundreds of very sophisticated templates. The beauty of creating ads with AdWords Scripts is that you can start simple and get more advanced over time as you learn what works well and what doesn’t.

The problem with using a Script to create ads from a feed is that AdWords Scripts don’t yet support some of the JavaScript methods to connect to a database where you most likely have your catalog of everything you sell along with all the attributes you’d want to use in the ad template like price, size, reviews, etc. Without access to this data, you can’t build a script to take over the ad creation process.

There is a workaround, however: an AdWords Script can connect to a Google Spreadsheet; so, if you have the items for which you want to create ads in there, automation is within reach. And, it turns out that Google Spreadsheets have scripting functionality that supports functions to connect to databases like MySQL.

Grab the code from Google to import your database into a Google Spreadsheet.

To implement this workaround, create a Google Spreadsheet that will be the source of all the data that needs to go into your new ads; then, program this spreadsheet to connect to your database and import all the items you need.

Because a Google Spreadsheet has a limited amount of data it can contain, you’ll most likely have to filter the data you import. For example, you could fetch only those items that were updated in the past 24 hours or only items that have an ID number that’s greater than the last ID your script processed (you could store this either in the spreadsheet or in your DB where the script can request it before fetching new data).

Use Triggers in the script and program one to run automatically once per day so that all the data you need to make new ads will be up to date.

Once you’ve got your Google Spreadsheet script up and running, schedule your AdWords Script to run automatically on the hour and look for any items in the spreadsheet that haven’t been processed, turning these into new ads and keywords. (I recommend running the AdWords script more frequently because it may not be able to process all of the data if it runs only once per day.) Exactly how you templatize this is up to you, but you can do some really neat things.

For example, using a “discount”-themed template when an item is inexpensive and a “premium”-themed template for items that are pricier, allowing you to make sure your ad text really speaks to your potential buyer. We’ve done this for several of our clients, and they love the results and the time it saves them.

While Bing adCenter doesn’t have any scripting capabilities, they do have bulk uploads — so you can actually have the script you write for AdWords generate a Bing bulk file for manual upload later.

Reduce Wasted Ad Spend On Bad Landing Pages

It’s a no-brainer that your ads should include landing pages that actually load. Any time a user clicks your ad and gets a server error, it is like flushing money down the toilet. I’ve seen cases where users still convert after getting a 404 error, but they are the exception and had to work hard to find the right page on the site where they wanted to buy. Luckily, finding broken links in your AdWords ads is easy with an AdWords Script.

Here’s the code that checks for a server error and also for the presence of the words “out of stock” on the landing page. If it sees these words or the server is not responding with a code ‘200’ (which means that everything is okay), the ad is paused.

function main() {

 var options =
 {
   "muteHttpExceptions" : true
 };

 var campaignNameContains = "Campaign #1";
 var ifThisTextIsOnPageThenPauseAd = "out of stock";

 var adSelector = AdWordsApp.ads()
   .withCondition("Status = ENABLED")
   .withCondition("CampaignName CONTAINS_IGNORE_CASE '" + 
    campaignNameContains.replace(/[\[\]\"]/g, "") + "'");

 var adIterator = adSelector.get();

 while(adIterator.hasNext()) {
   var ad = adIterator.next();
   var adId = ad.getId();
   var urlToTest = ad.getDestinationUrl();
   var response = UrlFetchApp.fetch(encodeURI(urlToTest), options);
   if(response != undefined) {
     var responseCode = response.getResponseCode();
     if(responseCode == 200){
       var responseText = response.getContentText();
       if(responseText != "") {
         if(responseText.indexOf(ifThisTextIsOnPageThenPauseAd) != -1) {
           Logger.log("Pause the Ad:" + adId);
           ad.pause();
         } else {
           // Logger.log("Activate the Ad:" + adId);
           // ad.enable();
         }
       }
     } else if (responseCode == 404){
       Logger.log("Pause the Ad:" + adId + " (404 error)");
       ad.pause();
     }
   }
 }
}

 

Detect Multiple Errors & Save Time

As you can see, this code doesn’t simply stop at checking for server errors. There are other reasons why a landing page could be bad and no longer worth advertising spend. Maybe the product has gone out of stock, is discontinued, or has received so many terrible reviews that virtually nobody wants to buy it anymore. Scripts can be told to look for specific text on landing pages that corresponds to each of these situations and then take the appropriate action, such as pausing the ad.

This automated process of going through thousands of destination URLs is really the only sensible way to prevent wasting money on ads that won’t convert. There are other tools that check for broken links, but they only provide you with a list of broken items and expect you to manually act on them.

Account managers’ time is much better spent on other tasks, and if you’re relying on a process that includes even a single manual step, you’re probably not doing as good a job as possible. When we recently ran this in the account of one of our clients, we instantly identified $4,000 worth of spend that would never lead to a sale. And, for a tool that’s free, saving $4,000 was quite the ROI!

Hopefully, this script for identifying and pausing bad landing pages and the ideas for how to tie your product database to an automated ad creation process has gotten your creative juices flowing, and you’ll create some great automation for your own accounts.

Opinions expressed in the article are those of the guest author and not necessarily Search Engine Land.

Related Topics: Channel: SEM | Enterprise SEM | Google: AdWords | How To: SEM | Search Ads: General

Sponsored


About The Author: is the founder and Chief Marketing Technologist of Top Tier Marketing, an online marketing agency specializing in AdWords. He is also the Cofounder of Optmyzr, an AdWords tool company that makes account management more efficient. Prior to forming Top Tier, Vallaeys spent 10 years building AdWords and teaching advertisers how to get the most out of it as the Google AdWords Evangelist.

Connect with the author via: Email | Twitter | Google+ | LinkedIn



SearchCap:

Get all the top search stories emailed daily!  

Share

Other ways to share:

Read before commenting! We welcome constructive comments and allow any that meet our common sense criteria. This means being respectful and polite to others. It means providing helpful information that contributes to a story or discussion. It means leaving links only that substantially add further to a discussion. Comments using foul language, being disrespectful to others or otherwise violating what we believe are common sense standards of discussion will be deleted. Comments may also be removed if they are posted from anonymous accounts. You can read more about our comments policy here.
  • http://twitter.com/Optmyzr optmyzr.com

    Great point on pausing ads that lead to broken landing pages! A lot of advertisers don’t even know this problem exists in their accounts. Pages now-a-days frequently use ajax, and sometimes the string can be present inside hidden fields (like in a script)- so need to be careful when looking for text on a page. We (optmyzr dot com) created a tool that automatically checks for such pages, pauses ads, and also resumes ads when pages start working :)

  • Crytal Cube

    Since the Script was rolled out, we have been trying to develop some of
    the most complex scripts that could automate a lot, I mean really a lot – to give an example it – automatically turning on/off ads/campaigns etc. if the weather is above let’s say 20 degrees…

    “The problem with
    using a Script to create ads from a feed is that AdWords Scripts don’t yet
    support some of the JavaScript methods to connect to a database where you

    most likely have your catalog of everything you sell along with all the attributes you’d want to use in the ad template like price, size, reviews, etc.”

    We have also managed to sort this out without any issues we
    created our own GUI etc. Once we have created all the campaigns more than 60 of
    them and now they are all automated. which also meant that we had to develop many many, many scripts to handle everything efficiently, which was quite a lot of work but it definitely worth doing in the end.

    To give an example of how many Scripts we had develop to
    talk with different layers (including managing bits, CAPs, increasing bits/decreasing bits/ turning on & off and many more) we had to create over 50+ massive Scripts plus GUI etc. And it has made our lives a lot easier now.

    If you are interested to know more drop me an email to: waiss21@googlemail.com

  • http://www.facebook.com/profile.php?id=14809522 Rob Peck
  • Crytal Cube

    Yeah good luck with that…

  • Lucas

    Is there an easy way to modify this code to send an email instead of pause the ad?

  • http://www.toptiertools.com/ Frederick Vallaeys

    You can do so much with AdWords Scripts but because they are limited in some ways, we have to get creative. At Google I/O last week I spoke with the AW Scripts team and they said using Google Sheets for data storage and using labels for storing state were great ways to get around some of the limitations. Sounds like your scripts must be pretty powerful with so many levels of scripts to do your ad automation!

  • http://www.toptiertools.com/ Frederick Vallaeys

    That’s not hard to do at all. You would replace the line “ad.pause();” with “MailApp.sendEmail(recipient, subject, body);”. Just replace recipient, body and subject with the email address, text for the email and subject line for the email. For example “MailApp.sendEmail(“me@example.com”, “Bad Destination URL Found”, “The AdWords Script found a destination URL that’s not so great” + urlToTest);”

  • Isma

    Does someone know if it’s possible to create/automate text ads for products based on a merchant center feed?
    As Merchant center and Adwords are already linked that would be the easiest way…

  • https://plus.google.com/u/0/106407507876126316370/posts Dan Sullivan

    Fred,

    This is fantastic. I was inspired to learn scripts after hearing you at the Hero Conference in Austin this year, and now searching how to auto pause product ads when they’re out of stock I found your article here.

    Question – I have yet to create a script – can you point to a starter document?

 

Get Our News, Everywhere!

Daily Email:

Follow Search Engine Land on Twitter @sengineland Like Search Engine Land on Facebook Follow Search Engine Land on Google+ Get the Search Engine Land Feed Connect with Search Engine Land on LinkedIn Check out our Tumblr! See us on Pinterest

 
 

Click to watch SMX conference video

Join us at one of our SMX or MarTech events:

United States

Europe

Australia & China

Learn more about: SMX | MarTech


Free Daily Search News Recap!

SearchCap is a once-per-day newsletter update - sign up below and get the news delivered to you!

 


 

Search Engine Land Periodic Table of SEO Success Factors

Get Your Copy
Read The Full SEO Guide