Login · Register
Home About Blog

Rotating Offers

There is several ways to rotate offers with Tracking202, but we will show you the simplest form of doing it.

All we are going to do is either add or edit a campaign, and instead of having the campaign affiliate URL be the normal affiliate URL, we will change to point towards a .php page on your site. For instance, set the affiliate URL now to mydomain.com/rotate.php?subid=, so now when traffic goes through your T202 setup, the visitor will be redirected to rotate.php; which will then redirect the visitor to the offer. Rotate.php will rotate between the offers that the users are redirected to.

It is important that when entering your URL into Tracking202, you should put ?subid= at the end of it, for instance: mydomain.com/rotate.php?subid= is what should be entered into T202, because remember, T202 adds a subid at the of the outbound affiliate url. On rotate.php we are going to grab the subid variable and attach it to the outbound rotated redirect links. Here is the code you would put on rotate.php below:

Rotate.php PHP Code


//Tracking202 Offer Rotation Script

//enter your affiliate urls below, you can enter as many as you want, please
//make sure that you have the affiliate url with the SUBID syntax at the end
//of it, for reference goto: subids.com for more information.
$offer[1] = 'http://myaffiliateurl.com?subid=';
$offer[2] = 'http://myaffiliateurl2.com?subid=';
$offer[3] = 'http://myaffiliateurl3.com?subid=';

//this is the text file, which will be stored in the same directory as this file, 
//count.txt needs to be CHMOD to 777, full privlledges, to read and write to it.
$myFile "count.txt";

//open the txt file
$fh = @fopen($myFile'r');
$offerNumber = @fread($fh5);

//see which landing page is next in line to be shown.
if ($offerNumber >= count($offer)) {
$offerNumber 1;
} else {
$offerNumber $offerNumber 1;

//write to the txt file.
$fh fopen($myFile'w') or die("can't open file");
$stringData $offerNumber "\n";

//grab the subid that t202 adds
$subid $_GET['subid'];

//redirect to the affilate url, + add the subid at the end
header('location: ' .$offer[$offerNumber] . $subid); 



Now T202 will redirect to mydomain.com/rotate.php?subid= and then rotate.php will grab the subid, and then redirect to the new affiliate urls; and this script of course rotates between as many affiliate urls you want to add to it. Also if you load mydomain.com/rotate.php in your browser, it should redirect you accordingly.

Tracking202 Warning: although this script works, it does have one down-fall. Tracking202 will not be able to determine the different offers, in that when you add/edit the campaign into tracking202 to goto your .php rotating script, tracking202 thinks its just redirecting to one offer, it won't be able to understand all the different offers which are being redirected to and analyze them in the reports. However, the script does work, and it should be used to temporarily find the best offer of the two and then switch back to one offer in the future after you have determined what works best!


  1. Ron Berg on Sep 03, 2008 at 2:43pm

    How does this differ from split testing LPs?



  2. Steven on Sep 03, 2008 at 3:27pm

    Hi Ron,

    Split testing LPs rotate through different LPs and tell you which one performs better. In this case, you're split testing the offers themselves. So lets say you have the same exact offer with the same exact offer page on more than one network, you can split test the offer to see which network converts better as oppose to assume that every network converts at the same rate. Hope that helps.

  3. Mark on Dec 26, 2008 at 9:02pm

    I am trying to get offers to rotate inside an iframe after 1 refresh.

    I am pretty content with my current LP. However I will end up split testing it with other ad copy/offers. I will end up using this script above, however is there an easy way to rotate offers inside my frame from a refresh? Or would this need to be done with each offer with it's only individual LP.

    Wasn't sure if a browser refresh carried over through an iframe. I guess it wouldn't matter either if it could just load on random.

    Thanks for any help.

  4. David on Jan 08, 2009 at 11:19am

    To get around the warning, why not just have the urls in the offer array be p202 redirects? That way, it'll count each offer accurately...

  5. JK on Jan 21, 2009 at 3:09pm

    I also want to rotate offers in an iframe (100% wide/high). Each visitor should get a random offer from the $offer array. The offer should be loaded by setting iframe src=(offer url).

    Is this possible?

    Thanks :)


  6. Forest on Apr 08, 2009 at 8:56pm

    Hey Dave, have you tested that and does it work? Can you give me a link example so that the sub id will pass to the prosper redirect....

  7. make money online on Sep 05, 2009 at 3:23am

    does it work please clear the dought

  8. Google Starter Kit on Sep 05, 2009 at 3:27am

    Yes, it is very good script. Thanks.

  9. Google Biz Kit on Sep 05, 2009 at 10:03pm

    I think, it is a great script!

  10. GOOGLE BIZ KIT on Sep 16, 2009 at 6:25am

    i like this script it is working

  11. PPVrookie on Oct 20, 2009 at 11:43pm

    "However, the script does work, and it should be used to temporarily find the best offer of the two"

    Wait, so how exactly do you figure out the winner if Tracking202 can't distinguish the different offers? Sorry, I'm a newb, so if you could explain this like you're talking to a baby, that would be great. :)

  12. DavidDamian on Oct 27, 2009 at 12:49am

    @PPVrookie: The "winner" is the one that yields more money at the end of the trial.

    Say you have an offer called "ACAI4YOU" that pays out $45 from Market Leverage (ML), and the same exact offer pays out $45 at Clickbooth (CB), and a third exact offer pays out $45 B-Line Revenue (BL). [Sometimes the merchant registers the same offer with multiple networks]

    Now, let us assume you used this rotator, and each network shows that you had 40 conversions. (120 in total)

    You might assume that each of them would pay the same. WHAT YOU DON'T KNOW is that the networks have what is called "scrubbing" where a certain number of YOUR conversions get "paid" to your affiliate manager, like a bonus if-you-will.

    They all have this ability, whether they act upon it or not; and it might be a very low number.

    You may come to find out (for example) that each network paid you:

    $1512 from ML (16% scrubbed)

    $1584 from CB (12% scrubbed)

    $1710 from BL ( 5% scrubbed)

    In this example, you find the better choice is BL's aff link, which pays out more. This is how rotating URLs benefits you so that you can see the better choice and then switch all traffic to it.

  13. ctrtard on Feb 26, 2010 at 1:46am

    I did a full tutorial on how to split test/rotate offers here:


    The technique and script I have will allow even rotation via count file and also psuedo rotation based on a random number. It also should properly keep track of which offer is converting.

  14. Steven on Feb 26, 2010 at 9:00pm

    Is this still current?

    Tracking202 has some rudimentary rotation now built in under "#3 Aff Campaigns" which seems to be doing the exact same as this hack. Am I right? If yes, why is this still posted here?

  15. Kyle on Apr 07, 2010 at 10:51pm


    I was thinking the same think. Hopefully someone will answer this question. It seems you can just rotate between 5 offers with that option in T202 though I guess if you wanted to rotate more offers this script will still be good for that.

  16. matthew berman on Apr 10, 2010 at 3:20pm

    the rotate offers feature doesn't do shit. there's no way to track the performance of the two offers separately, so basically its useless. hopefully this gets resolved.

  17. Chris on May 14, 2010 at 6:53am

    any update on this? need the rotation guys.. please clear this up..

  18. Dave on Jun 28, 2010 at 5:46pm

    The Rotate Offers in Affiliate Setup in T202 is for only rotating different LP's for the SAME offer. You can track this by altering the subid for each LP to whatever you want to distinguish which LP traffic & conversions are coming from.

    The script above goes a step before that as it rotates DIFFERENT offers. This is tracked in T202.

    Although in the examples above people have given examples of rotating teh same offer with different networks, essentially for clarity I've called them different offers as they have different affiliate links/networks.

  19. dorin on Dec 04, 2010 at 4:19pm

    hEY, this might be just a stupid uestion:

    What do I do with the script?

    Ok, so I replace the affiliate url's ...and after that?

    Do I post it on simple page or what?

    Thanks :)

  20. Georgie on Jan 05, 2011 at 7:26pm

    You're right dorin, that is a stupid question.

  21. david on Mar 30, 2011 at 11:23pm

    The rotate URL feature in #3 Aff Campaigns is same as this rotate script? who can explain it?And this script only rotate the offer with same payout,if you want to rotate the same offer with different payout ,then how to deal with.Is there any method?

  22. Anton on Jul 19, 2012 at 3:16am

    Sorry, I am a bit confused - is this script only for tracking202 users or will it work with self-hosted prosper 202 as well?

    If only the former, where can I find a redirect code for prosper202?

    thank you

  23. Prodak on Oct 24, 2012 at 10:30pm

    What if insted of adding CPA network links I add t202 campaign direct links?

    Then I drive traffic to mydomain.com/rotate.php?subid=

    That way t202 shoud track the traffic sent to each campaign.

    Would that work?

  24. davidd on Feb 24, 2013 at 8:27am

    same question as anton above. is this script compatible with prosper202? does prosper202 allow this also? if not does anyone know where to get a similar script?

  25. Frank on May 19, 2013 at 2:05pm

    How about making it easy:


    $urls = array("www.site1.com","www.site2.com","www.site3.com");

    $url = $urls[array_rand($urls)];

    header("Location: http://$url");


  26. jaouadk on Aug 26, 2013 at 12:58am


    This won't work my friend, since we want to dispatch the same number of clicks to each offer, if you use array_rand you could send your visitors to the same offer more often than the others.

    Writing/reading from a txt file is the best thing to do at this level.

  27. Sanj on Oct 03, 2013 at 6:23am

    Do you have this script in JS?


  28. James on Feb 12, 2015 at 10:48am

    Why is this code not built in to tracking202?

    Why do we have to code this on every page?

    Seems simple enough to implement from the control panel!

  29. Pavel on Feb 22, 2015 at 2:36pm


    I guess it is already built into t202.

    Try this:

    ClickServer - Setup - #3 Campaings - Rotate Urls: YES

    p.s. See that the first comment was published in 2008 (7 years ago!)

  30. Marko on Mar 25, 2015 at 3:34am


    My CPA offer has 3 LP, and I want to rotate them to see which converts best. My questions are:

    1. I just put my 3 affiliate links under "Campaign URL", "Rotate Url #2", and "Rotate Url #3". Is this correct?

    2. Do I have to put tracking placeholders [[subid]], [[c1]], [[c2]] after each link or only after the first one under "Campaign URL"?

    3. I'm not sure how "Rotate Urls" works. What I mean is, if you can define somewhere the number of times each page will be displayed, or is it all automatically and randomly selected?

    I would really appreciate your help. Thanks.

  31. Ashok on May 05, 2015 at 11:06pm

    Hey Marko

    Good questions that you have raised

    Have you got the answers yet as I am also looking for the same answers

    Especially regarding

    "2. Do I have to put tracking placeholders [[subid]], [[c1]], [[c2]] after each link or only after the first one under "Campaign URL"?"

    Let me know if you get the answers


Leave a Reply

Name (required)

Email (will not be published) (required)


What does 4 + 4 equal? (required spam filter)

Creative Commons License This work (Prosper202, Tracking202 and Export202) is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.