Weather Forecast Script to Bid Modify Around Snow events

74 views
Skip to first unread message

Jonathan Riedel

unread,
Nov 22, 2023, 3:08:01 AM11/22/23
to Google Ads Scripts Forum
Hi there,  

im trying to customize a script based on weather events specifically snow, snowy days in the forecast and this script has rain as default so I modified what I thought should work but anyone have any script they already by chance made for snow? I found this section and think I just need to modify everything in red to be specific to snowy days, campaign ID and ad group ID. 

const nyWeather = getWeatherForecastForLocation("New York City, US");
let coldDays = 0;
for (const date in nyWeather.forecast) {
 
const forecast = nyWeather.forecast[date];

 
if (forecast.snow > 5 && forecast.temperature < 273) {
   
coldDays = coldDays + 1;
 
}
}

if (coldDays > 4) {
 
const adGroup = AdsApp.adGroups()
     
.withCondition("campaign.name = 'New York Shoes'")
     
.withCondition("ad_group.name = 'Snow boots'")
     
.get()
     
.next();
  adGroup
.bidding().setCpc(adGroup.bidding().getCpc() + 0.3);
}

Any insights, tips, help are all greatly appreciated.

Sigurd Fabrin

unread,
Nov 28, 2023, 8:59:45 AM11/28/23
to Google Ads Scripts Forum
The script is incomplete. Example where is this function you're referencing getWeatherForecastForLocation("New York City, US");

It should be fairly simple to import weather data into Google sheets and then have an Ads script change bids based on what it finds in the sheet

Google Ads Scripts Forum Advisor

unread,
Nov 29, 2023, 3:25:56 AM11/29/23
to adwords...@googlegroups.com
Thanks Sigurd for the suggestion.

Hi,

Thank you for reaching out to the Google Ads Scripts support team.

By reviewing your query, I understand that you are trying to customize a script based on weather events specifically snow. I would suggest you refer to the document Generic Weather-based Campaign Management to get more information. Also, please go through the guide Bid By Weather for more details.

I hope this helps. Kindly get back to us if you have any further queries.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qVL8U:ref"

Thanks,
 
Google Logo Google Ads Scripts Team


Reply all
Reply to author
Forward
0 new messages