Search
Clear search
Close search
Google apps
Main menu

Using scripts to make automated changes

AdWords scripts let you make automated changes in your AdWords account. Using JavaScript code, you can change bids, pause ad groups, and add keywords with written scripts directly instead of manually within your AdWords account.

Scripts may work well for you if you manage large campaigns and you or a colleague have scripting skills. You can put these skills to work to make broad changes across your account, saving yourself time. Scripts can also be used to modify multiple accounts through a manager account.

Once you've created a script, you can manage your scripts and review actions taken by scripts within your account.

How scripts work

AdWords scripts let you automate actions in your AdWords account by entering JavaScript code in your account. You can use scripts to create, edit, or remove items in your account, saving you time and letting you manage your account more easily.

Here are a few ways you can use scripts:

  • Use data from external sources to initiate changes. For example, use external conversion data to make bid changes, or external inventory data to pause/unpause keywords as inventory becomes low. Or, read your campaign data and stats to create highly customized reports, output them to a spreadsheet, and graph it over time.
  • Take action across multiple elements of your account. For example, if a keyword has been hogging your spend for the day, you can both pause the keyword and increase budget at the same time.
  • Make changes across all items in your account. For example, increase the CPC bids by 30% for all keywords that generated over 1000 impressions last week.
  • If you manage multiple accounts through a manager account, you can run one script across multiple child accounts to optimize bids, create multi-account reports, and monitor for potential problems (such as fixing broken links or conflicting negative keywords).

Scripts could be a good choice for you if you know or work with someone who can use JavaScript, and have a large account that you want to make changes across in an automated way. Keep in mind that changes to your scripts can't be undone.

If you don't have scripting skills, or prefer a more structured way of making and scheduling changes, you may wish to consider using automated rules.

Example

Liana recently redesigned her floral website, and she's added a cool new landing page that will inspire all her customers to go into a tulip frenzy. Right now, she's defined a keyword final URL for tulip-related keywords on her campaigns to point to http://www.example.com/tulips/BoringOldPage. She can use a script to change all the final URLs for her tulip-related keywords across all campaigns in her account to use http://www.example.com/tulips/FancyNewPage instead.

Creating or running a pre-made script

The easiest way to get started with scripts is to edit a pre-made script from our library of scripts. You can either use these scripts as they are written, or adjust the JavaScript to create a custom script. For example, you can use these pre-made scripts to:

You can also build your own custom scripts by piecing together snippets of pre-made JavaScript to create a larger script.

Writing your own script

The most important step to creating a script is to write the JavaScript that you want to take the desired action in your account. Detailed instructions for designing a script can be found on our developer's site.

Once you're ready to create your script, here's how to add it to your account:

  1. Sign in to your account at https://adwords.google.com.
  2. Visit the Campaigns tab.
  3. From the sidebar, click Bulk operations, then choose Scripts. (If you’re in a manager account, click Scripts in the sidebar.)
  4. Click the "+ Script" button.
  5. In the "Script" field at the top, name your script.
  6. In the script editor box, enter your JavaScript code. If you write your scripts directly within the script editor, you can use auto-complete, syntax cues, and indentation for quicker script writing.
  7. If you're not ready to run your script yet, click "Save" above the editor. Or click the icon to the right of "Preview" to see a preview of the results of running your script for 30-seconds.

    Note

    Before previewing or running the changes, you'll get a message asking you to authorize this script to make changes on your account. Click "Authorize now" above the script editor, then "Grant access" to confirm this script has the authority to make changes in your account.
  8. When you're ready, click "Run script now" below the script editor to do just that.
Try it now

When you run a script, it will appear in the "Logs" section with information about its progress. You can stop a script by clicking the Stop button next to any running script.

Keep in mind

Scripts that run for longer than 30 minutes – or 60 minutes for certain types of manager account scripts – will time out. If your script times out, not all of your changes may be completed. To confirm that your script ran without a timeout, please check your logs. If your script timed out, we encourage you to refine it and run it again.

Tip

When in the script editor box, you can click the "Show examples" button above the box to see example scripts for common actions you might want to set up scripts for. You can then copy in the samples and tweak them for your particular situation.

Scheduling a script

Once you've created a script, you can schedule it to run once, daily, weekly or monthly at a certain hour:

  1. On the Scripts page in the "Actions" column, click + Create schedule next to the script you'd like to schedule. 
  2. In the drop-down box next to "Frequency," choose how often you'd like your script to run.
  3. Depending on your choice of frequency, you can then choose an exact date, a day of the week or a day of the month. You can also choose the time you'd like your script to run.
  4. By default, we've checked the box next to "Email me if my authorization expires." This means you'll be emailed if your script can't run for any reason, which can occasionally happen if you have multiple scripts. Uncheck this box if you don't want to be notified. 
  5. Click Save.

If you later decide to run your script at a different time, click Change schedule in the "Actions" column of the row with your script.

Managing and tracking scripts

After you've created scripts, you'll find them all on the Scripts page of your account. A list of your current scripts appears at the top of the page.

Next to the name of each script, an icon in the Status column will indicate whether the script is enabled (green icon) or removed (red icon). You can remove a script by clicking the green icon, then choosing "Removed." Once you remove a script, you can't re-enable it.

Below the list of scripts, you'll see Logs for actions that your scripts have taken. You can see when each script ran and what the status was. If a more detailed log is available, a "View details" link will appear. This link will show you what changed, how, and what the value was before and after.

Fixing issues with scripts

If you have any issues writing, editing, or running a script, you can find help on our developers community forum. The forum welcomes advertisers - from beginners to experts - and features a network of experts who can provide guidance and best practices.

Next steps

 

Was this article helpful?
How can we improve it?
Sign in to AdWords

Get account-specific help and tips by signing in with your AdWords account email address, or learn how to get started with AdWords.