Weather & Sitelink script

Ever wanted to incorporate weather data in your campaigns? This script will help you to turn data into action. It switches sitelink A for sitelink B when it’s raining. You can configure a few variables to customize it to your needs, so take a look a get practical with data!

Why this script?

Recently I was in a sales meeting at my current client (Center Parcs). They manage several holiday parks in Europe where you can book a “cottage” (holiday home). In the meeting the Sales Director said:

One of the Unique Selling Points of Center Parcs is that we have an indoor swimming pool. So when you’re on holiday and it’s raining cats & dogs*, then you can still have fun with the kids!

And it’s true! All parks have a indoor swimming pool, shopping mall and a lot of indoor facilities. So that’s a great USP to communicate. However, the sitelink area is a much sought after piece of real estate in the Google SERP, so I’ve created a script thats swaps out one sitelink for another when is rains outside.

Open Weather API

The weather data in the script is provided by the Open Weather Map. You can use their API for free up to 60 calls per minute. I currently run the script every hour for one location, so this is sufficient. Signing up is easy & free. You can create your API-key after you’ve logged in on the API keys tab.

How to use?

The next step is to install the script in Google AdWords. You can find a “how to” here. Configure the script to your needs with te explanation below.

  • Open Weather API Key: fill in your key here
  • weatherLocation: fill in the location where you want to check the weather. Verify your location by doing a search on The correct naming and localization tag will be in the searchresults or on the result page
  • Conditions: the API returns different weather conditions. I use the weather summary to check if it’s raining in De Bilt. However, when it return “light rain”, then I want nothing to change. The conditions are listed here: link
  • Sitelinks: you can find the ID of a sitelink in the Shared Library > Business data > Main sitelink feed. Look up the sitelink you want to target (via filter) and look for the column “Item ID”.

Preview the script and check if everything works as expected. If yes, schedule it te run on the desired frequency and you’re done!


You can view the results in the Log and of course in Google ;):

Logs of AdWords weather script


70% of the script is copied from the Weather-based Campaign Management script from Google. So props for them. Go check out their page for some other practical uses of weather data.

*Cats & Dogs is not a Dutch phrase, so this is nog the exact wording he used. However, we do have a similar proverb but translated from Dutch to English that would be: “It’s raining with buckets from the sky” :).

I’m not a programmer by profession so the code is probably not DRY / SMART / CLEAN, etc, My apologies.


And of course the script itself:

69 thoughts on “Weather & Sitelink script

  1. Arno Witte Reply

    Hi Martijn,

    Thanks for sharing, very simple but clever!

    Did the script result in additional clicks/sales? Would be very interested in an article about the results 🙂


  2. David Reply

    This is a great script, really useful for your client a,d many others with similar strategies.

    I’ve been trying to modify it as i’d need something similar but it would be to add/remove Sitelinks based on Temperatures and not actual weather conditions. I’ve been trying to set up a code to run the script based on temperatures but I’m not all that comfortable with JS (limited understanding) so not been able to do it as of yet :-(.

    Is there a quick change to the code that can be done to run this based on temperature?

  3. zortilo nrel Reply

    I’m still learning from you, but I’m improving myself. I certainly liked reading everything that is posted on your site.Keep the aarticles coming. I enjoyed it!

  4. Lisette Salk Reply

    Undeniably believe that which you stated. Your favorite reason appeared to be on the web the simplest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they just do not know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people can take a signal. Will likely be back to get more. Thanks

  5. turnpakjes zonder mouwen Reply

    Hi there! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thank you for sharing!

  6. Mobiele car wash Reply

    Hi there, You have done an excellent job. I will certainly digg it and personally recommend to my friends. I am confident they will be benefited from this website.

  7. The Basterd Reply

    Great write-up, I am regular visitor of one’s site, maintain up the nice operate, and It’s going to be a regular visitor for a long time.

  8. vreyro linomit Reply

    What i do not realize is actually how you are no longer actually a lot more well-liked than you might be now. You are so intelligent. You know thus significantly in terms of this subject, produced me for my part believe it from a lot of varied angles. Its like men and women are not interested unless it is one thing to accomplish with Lady gaga! Your individual stuffs nice. At all times care for it up!

  9. Britsekorthaar Reply

    I am really impressed along with your writing talents and also with the format on your blog. Is that this a paid subject or did you customize it yourself? Either way stay up the excellent quality writing, it is rare to look a great weblog like this one nowadays..

  10. lace front wigs Reply

    Hi there, just became alert to your blog through Google, and found that it is really informative. I’m going to watch out for brussels. I’ll be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

  11. clip Reply

    Thank for your writting! I have read through some similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable articles like this or more to share with everyone!

  12. buy rove cart Reply

    This design is incredible! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Wonderful job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  13. Refurbished laptop Reply

    It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will share this site with my Facebook group. Chat soon!

  14. clip Reply

    Thank for your writting! I have read through some similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable articles like this or more to share with everyone!

  15. duiken hurghada Reply

    When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove people from that service? Thanks a lot!

  16. hemp moonrocks Reply

    Aw, this was a really nice post. In idea I wish to put in writing like this additionally – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and under no circumstances seem to get one thing done.

  17. escort schiphol Reply

    F*ckin’ amazing issues here. I’m very glad to look your article. Thanks so much and i’m looking ahead to touch you. Will you kindly drop me a e-mail?

  18. No dmarc record found Reply

    I do believe all of the concepts you have offered for your post. They’re really convincing and can definitely work. Nonetheless, the posts are very brief for novices. May just you please prolong them a bit from subsequent time? Thank you for the post.

  19. Reply

    Thank you for every other informative blog. Where else could I am getting that type of information written in such an ideal method? I have a mission that I am simply now working on, and I’ve been at the glance out for such info.

  20. dewa poker Reply

    Those are yours alright! . We at least need to get these people stealing images to start blogging! They probably just did a image search and grabbed them. They look good though!

  21. tablecloth Reply

    Do you mind if I quote a few of your posts as long as I provide credit and sources back to your webpage? My website is in the exact same area of interest as yours and my users would really benefit from some of the information you provide here. Please let me know if this okay with you. Thank you!

  22. idn poker88 Reply

    Unquestionably believe that which you said. Your favorite justification appeared to be on the net the simplest thing to be aware of. I say to you, I certainly get irked while people think about worries that they plainly do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

  23. joker123 apk Reply

    I have read a few just right stuff here. Definitely value bookmarking for revisiting. I surprise how a lot effort you place to make such a excellent informative website.

  24. beleggingssoftware Reply

    I just like the valuable info you supply in your articles. I will bookmark your blog and check again right here regularly. I’m slightly certain I’ll be told many new stuff proper here! Best of luck for the next!

  25. teach English Reply

    Oh my goodness! an amazing article dude. Thank you However I am experiencing issue with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting identical rss downside? Anyone who knows kindly respond. Thnkx

  26. Netherlands RankingMasters .NL Reply

    Today, I went to the beach front with my children. I found a sea
    shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell
    to her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

  27. Club HDTV Reply

    Nice post and an excellent website, loaded quickly with nice design. The content was good. Thanks for creating this post, I will share this post with others and surely recommend it to close ones.

  28. Organic India Today Reply

    First of all thanks for creating the article with amazingly written content. I learn something useful after spending my time here. Please keep up this kind of good work doing.

  29. SureShot Clinic Reply

    SureshotClinic experts herbalists prepared various herbal supplements with years of experience and knowledge to cure various health-related problems completely without causing any side-effects.

  30. brujeria en ecuador Reply

    Howdy! I’m at work browsing your blog from my new iphone 4! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the great work!

  31. Reply

    What i do not realize is actually how you’re no longer actually a lot more well-appreciated than you may be now. You’re very intelligent. You understand thus considerably on the subject of this matter, produced me individually consider it from numerous various angles. Its like men and women aren’t involved except it?¦s one thing to accomplish with Woman gaga! Your individual stuffs nice. All the time deal with it up!

Leave a Reply to The Basterd Cancel reply

Your email address will not be published. Required fields are marked *