Clicky

X

Subscribe to our newsletter

Get the State of Digital Newsletter
Join an elite group of marketers receiving the best content in their mailbox
* = required field
Daily Updates

A Beginners Guide to Adwords Scripts

13 January 2014 BY

Until recently, using Adwords automation was not easy without investing in powerful and sometimes expensive software. Scripting is also something that is pretty intimidating (for me anyway!) which means that many PPC’ers may not have really looked at it yet.

Coding from scratch is not easy for a non coder, but using Adwords scripts does not have to be a headache thanks to some lovely people that have created a bunch of free resources to help – hopefully this will prevent you from running to the hills every time JavaScript is mentioned!

As you will see, it is ridiculously easy to get started – so don’t be afraid and jump right in!

Why are Scripts Great?

  • Time saved is the obvious first answer
  • Automation of routine tasks
  • Interaction with external data sources eg spreadsheets
  • Scripts solve a range of problems from simple to hardcore
  • You don’t have to be a coder – BONUS

Creating Your First Script

Hidden away in the Bulk Operations section of your Adwords account – scripts are kept with the Automated rules and Bulk edits functions.

create-new-script

Next you will need to add a script (next section)  and authorise the script (below) – and that’s it!! Simple Hey? So all we need now is to know how to code the scripts or where to get them from.

authorize-script

Where can I find Adwords Scripts?

Google actually provide some handy scripts from their script library including:

  • Campaign costs and clicks from the last month
  • Pause low-converting campaigns
  • Change campaign budget
  • Set default bids of all ad groups in a campaign
  • Enable ad groups for a brand
  • Pause ad groups that degrade over time
  • Log 20 keywords that had the most impressions yesterday
  • Pause keywords with bad average position in a campaign
  • Increase bids of well-performing keywords by 5%
  • Create a new keyword
  • Export daily report into Google spreadsheet
  • Change destination URLs
  • Enable ads for a promotion
  • Create a new text ad
  • Export disapproved ads into Google spreadsheet

Other Resources:

Neato Huh?

So lets try one out.

Export daily report into Google spreadsheet

This is a useful script for everyone and not much could go wrong with regards to accidentally setting bids of switching things off, so it is a safe one to start with!

First grab to code from the script library and paste into the script window:

featured-script

Save the script and authorise account access:

accept

Then cut and paste the script into the script window.

The Script

function main() {
  // Let's consider the 20 keywords that got the most impressions yesterday.
  var keywordsIterator = AdWordsApp.keywords()
      .orderBy("Impressions DESC")
      .forDateRange("YESTERDAY")
      .withLimit(20)
      .get();
  var now = new Date();
  var reportName = "DailyReport-" + Utilities.formatDate(now, "PST", "yyyyMMdd");
  // Create a new spreadsheet (will have private access for you only).
  var spreadsheet = SpreadsheetApp.create(reportName);
  // Get the default sheet.
  var sheet = spreadsheet.getActiveSheet();
  // Write header row.
  sheet.getRange("A1").setValue("Keyword");
  sheet.getRange("B1").setValue("Bid");
  sheet.getRange("C1").setValue("Impressions");
  sheet.getRange("D1").setValue("Cost");

  // Write body of report.
  for (var row = 2; keywordsIterator.hasNext(); row ++) {
    var keyword = keywordsIterator.next();
    var stats = keyword.getStatsFor("YESTERDAY");

    sheet.getRange("A" + row).setValue(keyword.getText());
    sheet.getRange("B" + row).setValue(keyword.getMaxCpc());
    sheet.getRange("C" + row).setValue(stats.getImpressions());
    sheet.getRange("D" + row).setValue(stats.getCost());
  }

  Logger.log("Report ready! Visit the following URL to see it:");
  Logger.log("https://docs.google.com/spreadsheet/ccc?key=" + spreadsheet.getId());
}

Preventing Errors

Scripts are cool but they can also be your worst nightmare if you accidentally make them do something they shouldn’t! As such, I advise that you review your script before you set it live, or better still set up a dummy. There isn’t really a test environment per se, so set a test campaign or an old paused account that is no longer used is a perfect place to test things.

preview

Once you are happy that the script is running as you wish – select run and the script will do it’s thing.

What Happens Now?

Once your chosen script has run, you will be directed back to the main scripts page where you will see your script. You can now see options to run a schedule and a link for access to the report that you have just run.

schedule

This script has not made any changes as we are just running a keyword report, so our exported file can be found using the Logs link.

google-drive-link

Et Voila! The top 20 keywords by impression from yesterday.

voila

There are plenty of useful scripts available online for FREE so have a go – you might be pleasantly surprised at how easy it is. If you have the luxury of access to a JavaScript genius then it should not take long to create customised scripts that are specific to each individual account need.

If you want to get some hands on training including Adwords Scripts then I will be running an Advanced Adwords Workshop next week at Biddable World in London on the 20th January 2014. If you have any questions, please feel free to ask me in person if you see me wandering about or comment below!

AUTHORED BY:
h

Jackie Hole is an Award Winning Search Marketing consultant specialising in Paid Search, Conversion Improvement and Organic Search / SEO for the USA, Canada and European markets. Starting out in Multimedia & Interface Design, Jackie has over 15 years experience in online marketing and was recently awarded European Search Personality of the Year. Jackie is Company Director of 22M

Nice job, you found it!

Now, go try out the 12th one:

Use Google Translate to bypass a paywall...

Ran into a page you can't read because it is blocked or paywalled? Here's a quick trick (doesn't always work, but often does!):

Type the page into Google translate (replace the example with the page you want):

http://translate.google.com/translate?sl=ja&tl=en&u=http://example.com/

How about that!?

Like this 12th trick? Tell others they need to look for this trick on our page: http://www.stateofdigital.com/search-hacks-marketers/

Or Tweet: Found the secret 12th one!