Weather Campaign Switcher
Runs weather-dependent campaigns only in the right weather: label campaigns weather:rain / dry / hot / cold and the script toggles them hourly using the free Open-Meteo API — no API key needed.
by Google & Martijn Kraan (concept), chiliad (rewrite)·web.archive.org/web/20220118144422/https://developers.google.com/google-ads/scripts/docs/solutions/weather-based-campaign-management
Overview
Umbrellas when it rains, ice cream when it's hot, snow tires when it freezes. Weather Campaign Switcher checks current conditions at your coordinates via the free Open-Meteo API (no key required) and enables or pauses campaigns based on their weather label: weather:rain, weather:dry, weather:hot, weather:cold. Only labeled campaigns are ever touched, thresholds are configurable, and every switch can be emailed.
Setup
- 1Open your Google Ads account and go to Tools → Bulk Actions → Scripts.
- 2Click the + button to create a new script and paste the code below.
- 3Set LATITUDE / LONGITUDE to your target market's coordinates.
- 4Create labels (weather:rain, weather:dry, weather:hot, weather:cold) and apply them to the relevant campaigns.
- 5Adjust the temperature/precipitation thresholds, then schedule HOURLY.
Configuration Variables
| Variable | Default |
|---|---|
LATITUDE / LONGITUDE | 52.37 / 4.89 (Amsterdam) |
HOT_THRESHOLD_C | 25 |
COLD_THRESHOLD_C | 5 |
RAIN_THRESHOLD_MM | 0.5 |
LABEL_PREFIX | weather: |
Expected Output
Current weather at 52.37,4.89: 27.4 C, precipitation 0 mm Active conditions: dry, hot [ENABLED] Ice Cream — Delivery (weather:hot) [PAUSED] Rain Gear — Umbrellas (weather:rain) Email sent to you@example.com
Notes
One location per script — for multi-city setups, run one copy per market with different labels (e.g. weather-ams:rain). The script owns the enable/pause state of labeled campaigns; don't hand-toggle them or the next run will toggle them back. Weather concept popularized by Google's retired weather-based bidding solution; this is a simpler label-based rewrite on a keyless API.