Skip to content

Instantly share code, notes, and snippets.

@elado
Last active April 9, 2024 03:19
Show Gist options
  • Star 29 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save elado/69fa611d84305dea4b38801880743928 to your computer and use it in GitHub Desktop.
Save elado/69fa611d84305dea4b38801880743928 to your computer and use it in GitHub Desktop.
American Express - Add all offers to card at once (bookmarklet)

American Express - Add all offers to card at once

If you own an AMEX card, you can add a bunch of offers to the card in this link: https://global.americanexpress.com/offers/eligible

There are many offers, and they change all the time. Instead of clicking "Add to card" repeatedly, I created this bookmarklet.

In Chrome, add a new bookmark (right click on bookmarks bar -> "Add Page...") with the following URL:

javascript:btns=[...document.querySelectorAll('.offer-cta')].filter(b => b.textContent === 'Add to Card');c=()=>{ b = btns.shift(); if (!b) return; b.click(); setTimeout(c, Math.random() * 300) };c();

Just visit that bookmark while on the offers page, and watch the magic happens!

javascript:btns=[...document.querySelectorAll('.offer-cta')].filter(b => b.textContent === 'Add to Card');c=()=>{ b = btns.shift(); if (!b) return; b.click(); setTimeout(c, Math.random() * 300) };c();
@batinthestacks
Copy link

batinthestacks commented Feb 18, 2024

The following modified version worked for me. Note I increased the minimum timeout to .8 seconds and log each clicked offer.

javascript:btns=Array.from(document.querySelectorAll("button[title='Add to Card']")),(c=()=>{if(!(b=btns.pop()))return console.log("added all!");b.click(),console.log("clicked:"+b.getAttribute("aria-label")),setTimeout(c,1500*Math.random()+800)})();

Here it is not minified
btns=Array.from(document.querySelectorAll("button[title='Add to Card']"));
c=()=>{ b = btns.pop();
if (!b) return console.log("added all!");
b.click();
console.log("clicked:"+b.getAttribute("aria-label"));
setTimeout(c, Math.random() * 1500 + 800) };
c();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment