Learning Adwords Scripts

Share with:

Adwords Scripts have been around for several years. Scripts are basically a little snippet of code that you add to your Adwords account, and they do several things, including:

• Run reports and email them to you or output into a Google Sheet
• Notify you of changes to your account performance
• Make changes to bids, ads, campaigns, etc.

Scripts are a type of account automation, and can be highly useful.

I’m ashamed to admit that I haven’t ever set up a single script.

I have a couple PPC accounts using scripts that other people set up, but I’ve never done one myself. I know from conversations in PPC Chat that I’m not alone, either. So, let’s learn Adwords Scripts together.

Finding a Script

Thankfully, there are several resources where you can find free Adwords Scripts without having to write your own. (If I have to write my own, I’m done, right now.) Here are a few resources I’m aware of; I’m sure there are more.

Free Adwords Scripts. There are a bunch of free scripts on this site. We’ve used a few of them, including the ad test significance script. It’s not perfect, and I like AdAlysis better for this task, but it’s better than cranking ad copy test data by hand.

Optmyzr. Frederick Vallaeys, a former Google employee, has some free scripts on his site you can use. If you’re an Optmyzr customer, there are many more scripts available. There’s also a how-to on installing scripts.

The Adwords interface. Adwords has a whole library of free scripts, helpfully organized by task.

Koozai’s big list. A list of 100 free scripts.

Using a Script

OK, finding a script is pretty easy. Implementing it is what scares me. I’m going to walk through the steps here, so we can learn together.

I’ve decided to try the Declining Ad Groups Report from the Adwords script library. It seems like a helpful script, and it doesn’t make any changes to your account – it just outputs the results into a Google Doc that you can review.

The instructions are all at the script URL, so I won’t re-copy them in detail here. The first step is to copy the Google Sheets template, and save it:

OK, that was easy enough. Now, we go to Scripts in Adwords to create a new script. It’s in the Bulk Operations menu in the left nav.

Click the +Script button, give the script a name, authorize it, and save it.

Then, paste in the code for the script from the Adwords site:

For this script, I also had to make one change to the code to paste the URL of my Google Sheet in the designated spot. It was easy to do, based on Google’s directions. Click save, and then Preview to preview your script results.

The results will populate in the Google Sheet:

OK, this is cool. I now have a list of ad groups whose performance has been declining over the past 3 weeks. The account to which I added this script is large, and also fairly new to us, so we’re still getting the feel of it. This script will help me pinpoint ad groups that need attention.

I scheduled the script to run once a week:

I set it for Sunday so it will be ready for me every Monday morning. The script sends an email to me every time it runs, so I don’t have to remember to go check the Google Sheet for updates. You can also click the “Run” button to run the script immediately.

So, How Was It?

As I said, until now I’d never set up a script before. I have to say, this was a lot easier than I expected! I thought there would be complicated changes to the script language that I’d have to make, but there was only one, and it was easy:

I just had to replace “YOUR_SPREADSHEET_URL” with the URL of my Google Sheet. Easy! If you’re used to looking at website source code, simple changes like this are no big deal.

Of course, I immediately started to wonder if I could add metrics to this script. For example, I’d love to add conversions, cost per conversion, and conversion rate to the metrics, in addition to cost and CTR. I have no idea how to do that. I suppose I could copy the part of the code for CTR and change it to conversion rate, but I don’t know if that will work. For now, CTR and cost are fine – for this client, these are important metrics, so I can live with that for now. But for other clients, the only metrics I’d care about would be conversions and cost per conversion. I’d love to know how to modify the script to include those, or swap them for CTR and cost. Anybody know how?

I’m pleasantly surprised at how easy this was. Here I’d been scared to try scripts! So if you’ve been putting off trying out Adwords Scripts, stop waiting and give them a try.

What are your favorite Adwords Scripts? And seriously, if you know how I can add conversions and cost per conversion, share in the comments!

Related Posts:


  1. This is the code where it is storing campaign name, ad group name, CTR and Cost for various time periods.

    reportRows.push([adGroup.getCampaign().getName(), adGroup.getName(),
    statsLastWeek.getCtr(), statsLastWeek.getCost(),
    statsTwoWeeksAgo.getCtr(), statsTwoWeeksAgo.getCost(),
    statsThreeWeeksAgo.getCtr(), statsThreeWeeksAgo.getCost()]);

    This is a stat object from which data is being retrieved.


    On this object, you can call getConversions() to, well, get the conversions. So, statsLastWeek.getConversions() will give conversions for last week, statsTwoWeeksAgo.getConversions() will give conversions for two weeks ago, etc.

    The stats object doesn’t have a ready made Cost/Conv metric. You need to derive it using cost and conversions.

    • Melissa Mackey says

      Yes! I knew someone out there would know how to do this. I can calculate cost per conversion manually. Thank you!!

  2. Nice post. I too have heard of some very interesting AdWords Scripts including one that modifies the ad copy (e.g. % discount offer) based on real time data (e.g. stock availability). But I’ve never used them before. Maybe, after reading this post, I’ll start!

    • Melissa Mackey says

      I’ve seen those scripts too. Might be interesting to test on a single campaign to see how they work!

    • A good half-way house on these can be to use the Business Data to customise ad copy with price, text, etc, rather than using Scripts. It can be a little easier to set up and wrap your head around. It will depend on how often your data changes, but to get you used to the concept they work really well!

  3. Hi Mel,

    I too had been script adverse for a long time. I did however start using them in earnest a couple years ago.
    Here are a couple bits of advice for those starting out… kind of captain obvious advice, but that is exactly what guys like me tend to pass over and forget to pay attention to.

    Scripts are part of your optimization strategy. So you need to have a strategy before you start playing around with scripts. If you have not been a user of adwords for a long time and don’t have great optimization chops, learn that part manually first, then start to automate your daily manual activities.

    Alerts are a great place to start. Many of us spend too much time poking around looking for problems to fix or success to emulate. These activities are great areas to automate with alerts and come with the added bonus of not jacking up you bidding strategies.

    Be careful with bidding scripts if you have offline conversions. High CTR and or quality scores are great, but don’t always indicate great sales (conversions) offline. Its risky to make that assumption.

    As you said Mel, learn a new PPC account’s nuances before you start to apply scripts that will fundamentally changes its strategy (bidding, turning on/off ads adgroups etc.). Instead start with tried and true alert scripts.

    Build a library of your most trusted scripts so you can apply them with confidence to new accounts.

  4. MCC Link Checker Script. Tis a thing of beauty. – https://developers.google.com/adwords/scripts/docs/solutions/mccapp-link-checker


  1. […] A well-deserved finally for Melissa Mackey of Beyond the Paid as she dips her toes into the waters of SEM automation with AdWords scripting. […]

Speak Your Mind


This site uses Akismet to reduce spam. Learn how your comment data is processed.