It’s that time of year… drums please, summer summertime!” The time of year when the sun is shinning one minute and the next minute, rain is ruining your summer BBQ plans. If you have a product or service that is directly affected by the weather, this post is for you! The AdWords bid by weather script is simple to set up and allows you to optimize bids automatically based on geo-location and weather forecasts.

What type of account would bid by weather scripts work well for, you ask? How about golf courses that may want to bid more on a sunny day and decrease bids on a rainy day. Or a company that sells snow blowers or umbrellas? Changing bids manually based on the weather can be very time consuming and nearly impossible.  This, my friends, is where weather scripts come in and save the day!

How It Works

The script first references a Google spreadsheet that has the campaigns and geo locations. Then, the script calls to the OpenWeatherMapAPI where it references current weather conditions for the locations specified in the spreadsheet and some basic rules. If the rule evaluates to be true, then the bid multipliers are applied to the campaigns specified. An example of a rule could be > if it’s sunny, increase bids by 10% for Ann Arbor, Michigan. You will specify what is considered “sunny” on another tab in the Google spreadsheet, which I will cover in more detail later on in this post. First, we will cover the basics.

Getting Started


  1. Register for an API key at the *Make a note of your API Key. You will need this for the script.
  2. Make a copy of the bid by weather template spreadsheet located here
  3. Make sure the geo-locations are set on the AdWords campaigns you plan to use – *The script will not change geo-location of the campaign or fire if the location does not match.
  4. Identify weather locations according the OpenWeatherMap API. The location entered must match what is listed on the OpenWeatherMap API
  5. Gather a list of AdWords geo target codes based on location. Here is the complete list of geo target codes.

Creating The Google Spreadsheet

If you have downloaded and renamed the template listed above, next you will need to fill out the data in the Google spreadsheet. The Google spreadsheet includes three tabs – Campaign, Weather Conditions, Geo targeting mapping. Make sure that you take the time to ensure everything matches correctly to the OpenWeatherMap cities and Google geo codes otherwise the script won’t fire.

Campaign Tab


The campaign tab you will need to fill out the following information:

  • Campaign name: The name of the campaign to be modified.
  • Weather location: The location for which weather conditions should be checked.
  • Weather condition: The weather condition for which this rule should be applied.
  • Bid modifier: The location bid modifier to be applied if the weather condition is met.
  • Enabled: Specify [yes] to enable a rule and [no] to disable it.

Weather Condition

As you can see in the image above, you will need to determine what is considered “Sunny”. For example: Sunny = Temperature between 65 to 80 degrees Fahrenheit, Precipitation below 1mm of rain in the last 3 hours and wind less than 5mph.

If you leave cell blank, the value of that cell is not considered for calculation and will look something like this:

Sunny Var Code

Geo-target mapping

Weather Location

On this tab you will need to define and map the weather locations that are defined on the campaign tab. If you’ve already pulled this data from step 3 & 4 listed above you can just plug right into the spreadsheet. The two columns you will need to input the data are listed below:

Weather Location – This is a weather location name, as understood by the OpenWeatherMap API. You can find this data here

Geo target code: This is a geo target code, as understood by AdWords scripts. You can refer to for a list of supported geo target codes.

You may need to list multiple geo-target code for a specific weather location because the weather location targeting is not as granular as the AdWords targeting. See example below.

The Script

You can find a copy of the bid by weather script here. Place the script in your AdWords account under: Bulk operations > Scripts. You will need to have your open weather API Key code and the link to your Google spreadsheet as mentioned below.


The script will read rules from all three sheets in order. If the data matches, the rule is executed and the bid modifiers are made. No changes will be made if the weather conditions do not match.

You can set up in AdWords how often you would like the script to fire and even go back and see what changes were made.

The overall set-up will take a little time to make sure all the data is entered correctly but once it’s set up, the script should save a ton of time and help your ads become more efficient if they are affected by the weather. Are you currently using bid by weather scripts for your account? How have they worked for you?