Weather Based Bid Adjustments

Google Developers have recently released a weather API script that can be used to alter ads based on real-time weather. This could be useful, if you were trying to create ads for an attraction and on rainy days you want to advertise indoor activities and on sunny days advertise outdoor activities.

The script does this by using the API from openweathermap.org you can get the instructions from google on how to set this up from: https://developers.google.com/adwords/scripts/docs/solutions/weather-based-campaign-management.

Setting Up the Script

After following the Google guide, you should have the script setup to their specifications. If you want to target more cities you need to add them to the Geo target mapping sheet in the Bid by weather Google Sheet. The Google Sheet found here, shows all the geocodes the OpenWeather API allows https://drive.google.com/open?id=1nNPhLAWMppLgDHaAHPJuVWZT78htwqd4UO7eltQWmZ4.

Temperature Changes

The script only allows you to use fahrenheit at the moment but it is easy to change if you want to use celsius. Simply add this function:

function toCelsius(kelvin) {
return kelvin - 273.15;
}

Next you want to find the function evaluateWeatherRules in there you will find a line saying:

var temperature = toFahrenheit(weather.main.temp);

Change this to:

var temperature = toCelsius(weather.main.temp);

Now you have to use celsius when setting up your weather rules on the spreadsheet. If you change your mind and want to use fahrenheit again simply change var temperature back to how it was originally.

Conclusion

While there is a lot of potential for this script to be useful the OpenWeather API is currently having issues with current rainfall in mm (precipitation). This results in sometimes you have a downpour in area and the API thinking it’s not raining will make bid adjustments that you probably dont want it to do. So it may be best to not use this until OpenWeather sort out these issues or use it to make bid adjustments on weather rules that have 0 rainfall.