100% Free Split Testing Script!

by Cash37
14 replies
Hi Warriors,

Here is a free split testing script I created in php. It can be tweaked to whatever you need it to be, consider this just a rough framework to begin. It doesn't rotate the offers 100% evenly but it does what I need it to do. Maybe it will be of some use to someone.

How to use the code:

Copy and paste the below in notepad and save as index.php then put inside a folder. Just link to that folder from wherever the split test is coming from. I've used this to split test landers from traffic sources and offers from my winning lander.

Code:
<?
if(rand(1,10) < 5) {
header("Location: http://www.affiliatelink.com");
} else {
header("Location: http://www.affiliatelink.com");
}
?>
How it works:

On line two, php calls a random number between 1-10. (Change this to rotate more or less frequently) If the number is less than 5, it goes to your first link. If its higher than 5 it goes to your second link.

Feel free to hack this code up for 3 way split tests, etc.

Let me know if it helps?
#100% #free #script #split
  • Profile picture of the author daddyshu
    Simple yet powerful! thx
    {{ DiscussionBoard.errors[8207566].message }}
  • Profile picture of the author joshua138
    thanks for share, mate
    {{ DiscussionBoard.errors[8207931].message }}
  • {{ DiscussionBoard.errors[8207943].message }}
    • Profile picture of the author Cram
      this post is 2010,
      we have great free and paid tools that do this for us now.

      bevomedia they have a free and paid account for split test LPs/offers/steps and able to see reports stats. with great support.
      imobitrax 130/month your able all the same.
      p202 self hosted, free but you need to get VPS or Dedi, support is lacking, only from users using the script will help out if they can.
      t202 hosted 150/month to 570/month
      {{ DiscussionBoard.errors[8208959].message }}
  • Profile picture of the author Johnny12345
    Originally Posted by Cash37 View Post

    It doesn't rotate the offers 100% evenly
    Code:
    <?
    if(rand(1,10) < 5) {
    header("Location: http://www.affiliatelink.com");
    } else {
    header("Location: http://www.affiliatelink.com");
    }
    ?>

    I'm NOT an expert PHP coder, but...

    If you're generating random numbers from 1 - 10, it won't rotate evenly because the conditional should be "<6" -- not "<5."

    If you were generating numbers from 0 - 9, using "<5" would be correct.

    But, right now, it's rotating if it's 1 - 4 or 5 - 10. That's a 40/60 split -- not a 50/50 split.

    Regards,

    John
    {{ DiscussionBoard.errors[8209025].message }}
  • Profile picture of the author robertmoney
    learning.maybe useful for me later.
    {{ DiscussionBoard.errors[8209036].message }}
  • Profile picture of the author Simiv68
    It doesn't rotate evenly because the random number it generates will sometimes be 2 (or more) in a row that are in the range of 1-5 or 6-10. It says greater than 5. 5 is not greater than itself.
    {{ DiscussionBoard.errors[8209143].message }}
    • Profile picture of the author Johnny12345
      Originally Posted by Simiv68 View Post

      It doesn't rotate evenly because the random number it generates will sometimes be 2 (or more) in a row that are in the range of 1-5 or 6-10. It says greater than 5. 5 is not greater than itself.

      The random numbers generated will even out over the course of many views. So that's NOT why it doesn't rotate evenly.

      The code says, "if the random number is LESS than 5." That means 4 or less. It doesn't mean 5 or less. That is why it isn't evenly rotated.

      John
      {{ DiscussionBoard.errors[8209609].message }}
      • Profile picture of the author Greedy
        Originally Posted by Johnny12345 View Post

        The random numbers generated will even out over the course of many views. So that's NOT why it doesn't rotate evenly.

        The code says, "if the random number is LESS than 5." That means 4 or less. It doesn't mean 5 or less. That is why it isn't evenly rotated.

        John
        I noticed that, that is why I linked to the 202 rotation script in my post above.

        It rotates evenly, even over a short time.
        {{ DiscussionBoard.errors[8210207].message }}
        • Profile picture of the author Lafftar
          The script on p202 site has such large strain on the server, this is good for people who just want quick, fast splitting. That being said, does anyone know how to make this rotate more than 2?
          would It just be:
          <?
          if(rand(1,10) < 5) {
          header("Location: http://www.affiliatelink.com");
          } else {
          header("Location: http://www.affiliatelink.com");
          } else {
          header("Location: http://www.affiliatelink.com");
          ?>
          Or is there something I need to change?
          {{ DiscussionBoard.errors[9334182].message }}
          • Profile picture of the author Bonadza Vojo
            Originally Posted by Lafftar View Post

            The script on p202 site has such large strain on the server, this is good for people who just want quick, fast splitting. That being said, does anyone know how to make this rotate more than 2?
            would It just be:
            <?
            if(rand(1,10) < 5) {
            header("Location: http://www.affiliatelink.com");
            } else {
            header("Location: http://www.affiliatelink.com");
            } else {
            header("Location: http://www.affiliatelink.com");
            ?>
            Or is there something I need to change?
            This would not work since you have 2 else statements.

            Try something like this

            $rand = rand(1,3);

            if ($rand == 1) {
            header("Location: http://www.affiliatelink.com");
            }

            if ($rand == 2) {
            header("Location: http://www.affiliatelink.com");
            }

            if ($rand == 3) {
            header("Location: http://www.affiliatelink.com");
            }
            {{ DiscussionBoard.errors[9334448].message }}
            • Profile picture of the author Cash37
              Originally Posted by Bonadza Vojo View Post

              This would not work since you have 2 else statements.

              Try something like this

              = rand(1,3);

              if ( == 1) {
              header("Location: http://www.affiliatelink.com");
              }

              if ( == 2) {
              header("Location: http://www.affiliatelink.com");
              }

              if ( == 3) {
              header("Location: http://www.affiliatelink.com");
              }
              This would be correct. My php wasn't that good back then (didn't even know how to use variables properly) but these simple scripts in this thread get the job done!
              {{ DiscussionBoard.errors[9725336].message }}
            • Profile picture of the author Hilton Junior
              Originally Posted by Bonadza Vojo View Post

              This would not work since you have 2 else statements.

              Try something like this

              = rand(1,3);

              if ( == 1) {
              header("Location: http://www.affiliatelink.com");
              }

              if ( == 2) {
              header("Location: http://www.affiliatelink.com");
              }

              if ( == 3) {
              header("Location: http://www.affiliatelink.com");
              }
              Really nice tip... I implemented and it worked like a charm =)
              {{ DiscussionBoard.errors[10781114].message }}
  • Profile picture of the author Carlos Stratton
    Awesome!
    Just copied to use in the future....

    Thanks
    {{ DiscussionBoard.errors[9726322].message }}

Trending Topics