Skip to content

Instantly share code, notes, and snippets.

@gowon
Last active March 14, 2017 01:56
Show Gist options
  • Save gowon/56c1e1e0ef2710c6fde04d93c612cee1 to your computer and use it in GitHub Desktop.
Save gowon/56c1e1e0ef2710c6fde04d93c612cee1 to your computer and use it in GitHub Desktop.
Amazon Affiliate Bookmarklet
javascript: (function(affiliateId) {
var match = document.location.href.match("/([a-zA-Z0-9]{10})(?:[/?]|$)");
if (!match) {
alert("Can't find the product ID.");
return;
}
prompt("Affiliate Link:", "http://amzn.com/" + match[1]+ "?tag=" + affiliateId);
})("goodornah-20")
javascript:(function(t){var o=document.location.href.match("/([a-zA-Z0-9]{10})(?:[/?]|$)");return o?void prompt("Affiliate Link:","http://amzn.com/"+o[1]+"?tag="+t):void alert("Can't find the product ID.")}("goodornah-20"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment