Why should I rely on PHPJabbers.com for all my PHP scripting needs? What do you offer me when buying some script?
  • Top quality scripts
  • Full demo before buying
  • Best pricing
  • Script customization
  • 7 days a week support
  • Installation support
  • Secure buying
  • Banner and link rotation

    posted on 2006-05-17 17:31:32

    I have many web sites and on most of them I run all kind of link/banner exchange or affiliate programs. Some of the affiliate programs perform much better and others are not that good. However, you will need a lot of time to find out which one perform better than the others. You will have to put a banner for the 1st affiliate program for few days and analyze its performance results. Then you will have to do the same for the other affiliate banners and at the end to choose the best one. Of course if you have 5 different banners you will need to spend 5 x 3 days each = 15 days to find out which one is the best.

    What I would suggest is to randomly show all the banners during the first 3 days. At the end you will have the impressions, clicks, sales results for all of the banners and you can decide which one to use a lot sooner.

    Now, what I am going to do is define PHP array with all the 5 affiliate codes. Then using the PHP rand(min,max) function I will randomly select one of these 5 array elements. The first parameter defines the minimum value that you want and the second parameter is for the maximum value that you want generated. In our case we need to use rand(1,5). All that has to be done now is to print the randomly selected array element.

    <?
    $mybanners[1] = '<a href="http://www.affiliate1.com"><img src="banner1.jpg"></a>';
    $mybanners[2] = '<a href="http://www.affiliate1.com"><img src="banner1.jpg"></a>';
    $mybanners[3] = '<a href="http://www.affiliate1.com"><img src="banner1.jpg"></a>';
    $mybanners[4] = '<a href="http://www.affiliate1.com"><img src="banner1.jpg"></a>';
    $mybanners[5] = '<a href="http://www.affiliate1.com"><img src="banner1.jpg"></a>';

    $id = rand(1,5);

    echo $mybanners[$id];
    ?>
    Comments
    Pete posted on 2008-05-22 22:16:26
    All makes sense

    Samuel posted on 2008-04-25 13:03:34
    What if I want to rotate the links evenly?

    sopha posted on 2007-08-04 06:49:01
    The blog: echo $mybanners[$i];
    Should chang to :echo $mybanners[$id]; to make it work.

    arnold posted on 2006-08-24 02:21:49
    Just wondering do you have actual demo?

    Pages:   1
       
    If you have any additions, suggestions or modifications for this example please send an email to or use the form below.
       
    Your name:
    Your email: (email address will not be posted on the web site)
    Comment:
    Verification