Making AuctionAds a little more Wordpress friendly

If you’re a Webmaster, and haven’t signed up for AuctionAds yet, you should. Basically it is an advertising network for the eBay affiliate program: The AuctionAds advertisement shows an item listed on eBay, if one of your viewers click on the ad and end up buying that item, you get a commission.

There is one problem with AuctionAds though. And that is, unlike Google Adsense’s ability to “read” the page and present contextual and relevant ads, AuctionAds has a “simple” parameter where you must enter keywords. So if you want AuctionAds to show Cell Phone listings on eBay, you need to enter “Cell Phone” into that field. While it allows the webmaster an ability to “focus” the ad, it’s rather tedious… you can’t enter one code, and expect that the ad will always be relevant. Maybe if your website was just about Cell Phones, that’d be cool. But if, for example, you’re using on a general blog where you post about a variety of topics, there’s no “simple” way to make the ad relevant.

To that end, I’ve written some simple code to work around that deficiency…

In single.php, find:

<?php the_content(); ?>

And add this above it:

<?php
$catname = ”;
foreach((get_the_category()) as $cat) {
$catname = $catname . $cat->cat_name . ‘,’;
}
$catname = rtrim($catname,’,');
?>
<script type=”text/javascript”><!–
auctionads_ad_kw = “<?php echo $catname; ?>”;
… your auctionads parameters …
–></script>
<script type=”text/javascript” src=”http://ads.auctionads.com/pagead/show_ads.js”>
<script>

What the code does is:

  • AuctionAds is to appear on each post: when you read the single blog post, you will call single.php (or whatever your theme calls it… Redoable calls it single_post.php).
  • Because I file all my blog posts in various Wordpress Categories, it’s relatively simple to identify the focus of each post.
  • Using PHP code, I extract the full category list for that specific post, and insert those words into the AuctionAds keyword field. Thus ensuring that AuctionAds presents auctions relevant to the topic of the blog post.

This is what I learnt today! Hopefully it’ll be of use to others :)

Comments
There are no comments just yet, why not be the first?
Leave a Comment
Add your picture!
Join MyBlogLog and upload your avatar. C'mon, it's free!