– Ben Martens

Safeway Coupon Clipping

In addition to regular paper coupons, our grocery store has started a program called “Just For U” where you can clip coupons online. They intend for you to flip through the coupons and add certain ones to your frequent shopper card. Those items show up in the phone app and you are supposed to go buy those specific items. I’ve never been one for clipping coupons, but every once in a while, I go to the site and click Add on every single coupon. We use OneNote to track our shopping lists so their app has no appeal to me. I save a few bucks here and there, but it’s not really worth my time to clip these virtual coupons.

Then one day I had an idea: why am I manually clicking on all these buttons? I’m a geek and geek’s don’t do this sort of repetitive stuff. We write code to do it for us! So with a little ingenuity, I whipped up a very basic piece of javascript that runs over the whole page, finds all the coupon buttons and then clicks them. Within a second or two, I can clip hundreds of coupons. I even made this a button in my browser toolbar so it’s nice and easy to run.

javascript:(async function(){ function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function scrollDown(count) { for (var i = 0; i < count; i++) { $(“.load-more”).click(); await sleep(1000); } } await scrollDown(10); $(‘.grid-coupon-btn:not([disabled])’).each(function(index,value){ });})()

This won’t help me save any more money, but it definitely means I spend less time clicking around on their website!

[11/23/2020] Updated Javascript to match the current website.