RPG Library

DriveThruRPG affiliate links

Here is a tool that will allow you to show the hottest or newest items at Drive Thru RPG and place a link to those items on your site. This widget randomly chooses one of the current five hottest items at DriveThruRPG, one of the current five newest items, or both. Refresh this page and check it out!

To use this widget, add the script below to the top of your web page between the <head> ... </head> tags (if you are not familiar with javascript, here is an excellent tutorial). You need to be able to edit the source of your page. If you add this script, and it appears on your web page just just as it appears here, that will not work. Look for an "edit source" button in your HTML editor, and add the script that way.

By default, the widget uses my affiliate ID (43463), but you can replace it with your own affiliate ID by replacing my affiliate number with yours. So if your affiliate number is 1234, you would replace "affiliate_id=43463" with "affiliate_id=1234" (not including the quotation marks).

By default, the widget creates an affiliate link for DriveThruRPG, but you can change that by changing the "site" value. The valid "site" values are:

comics
http://comics.drivethrustuff.com/
ecobrain
http://www.ecobrain.com/
fantasy
http://fantasy.drivethrustuff.com/
horror
http://horror.drivethrustuff.com/
mindsettriathlon
http://www.mindsettriathlon.com/
rpg
http://rpg.drivethrustuff.com/
scifi
http://scifi.drivethrustuff.com/
wargamevault
http://www.wargamevault.com/

For example, if your affiliate ID is 1234 and you want to create an affiliate link for Wargame Vault, you would add the script below to the top of your web page:

This loads the script, but it does not draw the widget. To draw the widget, simply paste the text below into the HTML of the page. Again, this needs to be the "source" of the page. If you are using a WYSIWYG editor, look for a button that says "edit source".

New item widget

This widget randomly chooses one of the current five newest items at DriveThruRPG.

Hot item widget

This widget randomly chooses one of the current five hottest items at DriveThruRPG.

Any item widget

This widget randomly chooses one of the current five hottest items or one of the current five newest items at DriveThruRPG.

Widgets with style

You can move this widget around by putting the javascript function call inside of other HTML code. For example, on this page, I make it float to the right by enclosing it in <div> tags:

Questions

If you have any questions or comments about this script, post them at my blog, Blackmoor Vituperative.

Notes

Update 2010-05-25: I added some error-checking in case the description field in DriveThruRPG's RSS feed contains some bad tags. It doesn't actually do anything with the errors, but it keeps the script from failing.

Update 2010-05-25, part 2: I expanded the script to be able to handle any of OneBookShelf's sites. This changes both the name of the script, the values passed to it, and the function calls, so take a look at it.

RPG Library RPG Library