Bitcoin Forum
May 27, 2024, 04:01:04 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Extention to augment Amazon links with my Affiliate Tag  (Read 3535 times)
moocow1452 (OP)
Sr. Member
****
Offline Offline

Activity: 240
Merit: 250

Don't mind me.


View Profile
March 30, 2012, 09:50:27 PM
 #1

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.
nathanghart
Full Member
***
Offline Offline

Activity: 195
Merit: 100


View Profile
March 30, 2012, 10:24:32 PM
 #2

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!