Author

Topic: Extention to augment Amazon links with my Affiliate Tag (Read 3555 times)

full member
Activity: 195
Merit: 100
I have an Amazon Affiliate link that's sitting around, doing not much of anything, so would it be kosher by Amazon's TOS to have a chrome extension, greasemonkey script or what have you that auto-magically diverts all Amazon outbound links through my affiliate address, and how would I pull that off in Javascript?

http://www.amazon.com/dp/product/[Product ID]/?tag=[Affiliate Tag]

I'm thinking it should be easy to do a look replace, but can someone do some hand holding and point me in the right direction? My java-fu is weak.

what about something like this
This is your chrome extension manifest
Code:
{
  "name": "Amazon Auto Affiliate",
  "version": "1.0",
  "description": "Adds an extension to change all amazon links to amazon links with your affiliate info.",
  "content_scripts": [
    {
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"],
 "run_at" : "document_end"
    }
  ]
}

Code:
// myscript.js

var affiliateCode = 'myafflicatecode'

onload = function () {
        for (var i = 0; i < document.links.length; i++)
     if (document.links[i].href.contains("amazon.com")) {
document.links[i].href = document.links[i].href +'?tag=' + affiliateCode
}
}

This should get you started with the basic framework....good luck.
sr. member
Activity: 240
Merit: 250
Don't mind me.
I have an Amazon Affiliate link that's sitting around, doing not much of anything, so would it be kosher by Amazon's TOS to have a chrome extension, greasemonkey script or what have you that auto-magically diverts all Amazon outbound links through my affiliate address, and how would I pull that off in Javascript?

http://www.amazon.com/dp/product/[Product ID]/?tag=[Affiliate Tag]

I'm thinking it should be easy to do a look replace, but can someone do some hand holding and point me in the right direction? My java-fu is weak.
Jump to: