Bid by Weather

Wouldn’t it be great if you could choose how much you pay to place each ad depending on the weather?

For example, imagine you are the head of marketing of an amusement park. How likely is anyone to visit your park if it is going to be windy and raining?

And how much more likely are they to go if they know it is going to be sunny and warm?

Just imagine if you could adjust your rates to bid to pay most when the advertisement is going to have the highest positive impact and likely client conversions, and least when the odds are against you for reasons out of your control…

Well – now you can! With the new Bid by Weather app in Ads scripts you can adjust how much you want to bid to place your ad depending on the weather forecast for your geographical area.

Rain drops falling from a black umbrella concept for bad weather

Bid by Weather in a Nutshell…

This app takes the time-consuming and tedious drudgery out of adjusting your ad bids on a daily, manual basis. Now in just a few minutes you can use Google Spreadsheets to program your localized campaigns to self correct according to weather forecast data, with your bids per ad being increased or decreased depending on the parameters you choose to pre-set.


Google Spreadsheets automatically contacts the OpenWeatherMap API  for each of your pre-selected locations and gathers expected weather conditions. The app then evaluates this information and uses basic rules to decide which bid multiplier (up or down) should be applied for each campaign at each location, depending on what the weather is predicted to do.


There are three separate spreadsheets on which information is collected:


Spreadsheet 1: General ad campaign data

First you need to pre-select the set of rules and which bid modifiers you want to apply according to a pre-determined set of parameters. The deciding factor on whether each specific rule will be applied will be the weather conditions for each selected location.


You need to provide date for the following columns:

  • Name of campaign: The name of the campaign to be modified.
  • Geographical location: The area where you want the weather conditions to be taken into account prior to placing your bid.
  • Weather conditions: What specific weather conditions are going to decide if this bid is applied or not?
  • Bid modifier: If the weather performs as you anticipated above, what type of bid modifier do you want to apply?
  • Enabled or disabled: Enter yes if you want to enable this rule or no if you want it to be disabled.


The rules that will be applied from the sheet above are:

  1. If it is sunny, to modify the bid for Test Campaign 1 by a factor of 1.3 for the New York area.
  2. If it is rainy, to modify the bid for Test Campaign 2 by a factor of 0.8 for the New York area.


Important details:

  • The rule only works if you have already pre-specified in which geographical area you want to search for weather conditions data (in other words, decide on your geographical areas first for each campaign).
  • Be aware that if you set up multiple choice rules for each campaign and geographical location, the last programmed rule that matches will be the one selected. This is important because the OpenWeatherMap API data is constantly updated as weather conditions change, which can affect how your ad bids are played out in real time.


Spreadsheet 2: Weather Conditions data

On this spreadsheet you will define the type of weather conditions that will decide if the rule is implemented or not. There are four columns, namely:

  • Condition Name: What kind of weather condition are you looking for?
  • Temperature: Specify the range of temperature you require in Fahrenheit.
  • Precipitation: Specify the amount in millimeters of rain to have fallen in the last 3 hours.
  • Wind: What is the range of wind-speed in miles per hour for which the rule will be applied?


As you can see on the spreadsheet above, for one specific campaign two different sets of weather condition parameters have been pre-programmed:

  1. Weather is sunny with the temperature measuring 65-80°F, less than 1 millimeter of rainfall in the last three hours and the wind speed is less than 5 miles per hour.
  2. Weather is rainy with more than 0 millimeters of rain falling in the last 3 hours and a wind-speed of less than 10 miles per hour.


Important details: You can define weather condition as being:

  • Specific values less than x (for example, below 5)
  • Specific values more than x (for example, above 5)
  • A range of values between x and y (for example, 70-80)
  • Leave the cell blank if you don’t want to include that parameter in the rule


Please note that all the parameters are considered together to calculate the specific weather condition. So, for example, the Sunny condition shown above is evaluated as:

var isSunny = (temperature >= 65 && temperature <= 80) && (precipitation < 1) && (wind < 5);


Spreadsheet 3: Weather location data

This spreadsheet defines which weather locations you use in your Campaign data (see Spreadsheet 1). There are just 2 columns:


Important details: 

  • For each selected weather location Ads scripts allow you to specify more than one geo-target code.  This is because Ads allows for smaller geographical areas than OpenWeatherMap API so you may have to enter more than one geo-target code to cover all of your desired geographical area. Write each geo-target code on a separate line with the same weather location name, as seen in the example below:



As you can see above, this spreadsheet is specifying 2 weather locations which cover one area of Boston (geo target code 10108127) and two areas in New York (geo target codes 21167 and 20050).


Google Spreadsheets Script logic

Google Spreadsheet scripts begins by reading all the rules off the three spreadsheets and then tries to execute each of them in sequence.


So, for each rule it:

  • Checks to see if the specific campaign has a weather location.
  • If it does target a weather location, the script then looks for the bid modifier data.
  • Then script contacts OpenWeatherMap API to verify if the actual weather conditions in the specified location coincide with those specified.
  • When there is not a match, the previous bid modifier holds good.
  • When there is a match, the selected bid modifiers are applied until the weather conditions change.
  • When the weather conditions change, the script automatically applies the new bid modifier that matches the actual conditions in that location.
  • If your campaign does not specify the weather location your bid will remain constant and will not be affected by the OpenWeatherMap data.


How to Setup Your Bid by Weather

  • Your first need to register for an OpenWeatherMap API key by going to
  • Copy the template spreadsheet and then enter your campaign data and specify your weather rules.
  • Create a new Ads script with this link.
  • Be sure to update the OPEN_WEATHER_MAP_API_KEY and SPREADSHEET_URL variables you see in the script.
  • Then schedule your Bid by Weather to run as desired.


If you would like to get additional information or have your Ads campaign set up contact your trusted Google Advertising specialists.

Recommended Posts