Skip to content


Dynamically create eBay widgets from existing rover code

Today, I read about the eBay widget. At first I was super stoked on the concept, and they look great. Here is a working example of the widget:

No Flash? What’s wrong with you?

Now my issue is this, it seems like you might be missing out on cookies since visitors might be viewing all the auction info directly from the widget vs going to eBay, and you would missing out on the cookie and affliate tracking. My initial tests with FireFox and Live HTTP headers seem to stress that cookie generation only occurs when you click ‘View & Bid’ in the widget. The jury is still out on this, and hopefully people will share some of their success and failures to help others make good decisions when it comes to the widget. I’m going to try to post any useful results as they occur.

In the meantime, I thought I’d give up this simple little function that will convert inputted rover code into the widget. This could be useful if you have content stored in the database with rover code embedded. You’ll need to download the swfobject.js file to help with IE browsers display object/embed tags.

<?php
define("PID", "123456790");
function convertEbayNew($inLink){
        $showWidget                     = true;
        $out                            = $inLink;
        if(eregi("(.*cgi.ebay.com.*)",$inLink)){
                $itemID                                         = ;
                $arr    = explode(‘QQ’,$inLink);
                if(sizeof($arr) > 0){
                        for($x = 0; $x < sizeof($arr); $x++){
                                if(ereg(‘(^itemZ)’,$arr[$x])){
                                        $item                   = explode(‘itemZ’,$arr[$x]);
                                        if(is_numeric($item[1])){
                                                $itemID         = $item[1];
                                        }
                                        unset($item);
                                }
                        }
                        unset($arr);
                }
                if($showWidget){
                        if(strlen(trim($itemID)) > 0){
                                $xid            = substr(md5(uniqid(rand(),1)),0,8);
                                $out            = ‘<p id="widget’.$xid.‘" align="center">’.$out.‘</p>
                                                                <script type="text/javascript">
                                                                var s0 = new SWFObject("http://togo.ebay.com/togo/togo.swf?2007111512","single","355","300","7");
                                                                s0.addVariable("base","http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=’
.$itemID.‘&query=your+query&pid=’.PID.‘");
                                                                s0.addVariable("width","355");
                                                                s0.addVariable("height","300");
                                                                s0.write("widget’
.$xid.‘");
                                                                </script>’
;
                        }
                }
        }
        return $out;
}
?>
<script type="text/javascript" src="swfobject.js"></script>
<?php echo convertEbayNew($link);?>
 

It’s pretty simple, and you could easily expand this to auto generate widgets in a forum (hint, look at preg_replace_callback()). If you have any thoughts, please comment here. There is also a DigitalPoint thread here that has a dicussion about this now.



Related posts:

  1. Roverize eBay links on the fly
  2. Using FFMpeg to create YouTube clone script
  3. Pay Attention to your Roll-Your-Own EPN sites
  4. Paging eBay RSS results
  5. Tracking converting keywords from your PPC campaigns

Posted in Affiliate Marketing, EPN, Programming.

Tagged with , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Powered by WP Hashcash