Return To Home Page Directory Of Non-Profit Organizations How You Can Help About givequick!
givequick!

Converting a site's Amazon affiliate links to GiveQuick! Giving Tree links using Search and Replace functions

By Paul Thomas

After seeing the GiveQuick! site for the first time, I immediately wanted to convert my site's links to the Giving Tree format. But the main obstacle was the nature of my site. It's a random mismash of topics and sub-sites, where book recommendations are scattered throughout. I didn't want to go through every file one by one, so I experimented with a few search-and-replace functions and came up with a simple two step approach to converting your site in just a few seconds (the following procedure was developed using Allaire's HomeSite under windows, but could certainly be duplicated in BBEdit on a Mac or Emacs under Linux; test each operation first on one file before doing it to the entire directory and subdirectories). Also, I always have a copy of my entire website on my home machine, so if you don't already, ftp down all of the html files from your site.

Step 1
A typical link on my site with Amazon affiliate information looked like this:
http://www.amazon.com/exec/obidos/ASIN/020141998X/haugheydotcom/

The randomized GiveQuick! links end in the ISBN, so I had to first cut out my affiliate information.

I performed a search-and-replace on all the html pages in my site backup, searching for my affiliate code, and replacing it with nothing (which deletes the text from the code).

[ view an illustration ]

My links now all resembled this one:
http://www.amazon.com/exec/obidos/ASIN/020141998X/

Step 2
Now that your links all end in ISBNs, you just have to change the link that precedes the ISBN.

The next step is to search for: http://www.amazon.com/exec/obidos/ASIN/

and replace it with: http://givequick.org/gt/amazon/

in all your html files, the final links will resemble this: http://givequick.org/gt/amazon/ASIN/020141998X

[ view an illustration ]

If you did your search and replaces correctly (make sure there are no spaces at the beginning or end of your search/replace criteria), your Amazon affiliate links should now all be converted and ready to help a variety of charities out.

Step 3 (optional)
As an added bonus to my site visitors and to give the Givequick.org site a little publicity, I decided to take advantage of the "title=" tag in IE 4/5, which gives visitors a message when links are moused over, like the alt tags do for images.

I searched for: href="http://givequick.org

and replaced it with: title="Proceeds from this book sale go to charity, visit GiveQuick.org for more info" href="http://givequick.org

So, for every <a href="...> tag, it would now read <a title="Proceeds...." href="....>. Don't worry, the order of the modifiers of the anchor tag <a> don't matter, it's quite alright for a title attribute to come before a href and vice versa.

[ view an illustration ]

If you want to be extra slick, the third step can be combined with the second step, adding the title tag to the replaced text all in one operation.

If your html editor of choice allows search and replaces across directories and subdirectories, following these simple steps should have your entire site converted in a matter of seconds.

givequick!
Return To Home Page Directory Of Non-Profit Organizations How You Can Help About givequick!