Split Testing Landing Pages With Tracking202
In this section we will show you how to split test several landing pages with Tracking202. All we are basically is going to do is make an-ever-changing landing page that rotates between several landing pages. It is really quite simple.
In Tracking202 you'll want to add several landing pages, you can denoate them differently for example: landingpage1, landingpage2, landingpage3 as the nicknames. For the URL just go ahead and set all the landing page URLs to the same page, as this page will rotate between all three of theses landing pages. Let us say for instance you will be sending your visitors to example.com/landingpage.php, ok, so then put that as your landing page URL.
Now grab the landing page code for each of theses new landing pages, and then put the code on different pages. For instance, landingpage1.php, (put the landingpage1 JS code on there), then make landingpage2.php, (put landingpage2 JS code on that one), and so on forth, for how many landing pages you have.
So now you have, in this example, we have 3 different landing pages, each has been added into Tracking202, and there is a unique .php file for each of the landing pages on your domain. In T202 all your landing page URLS should point to: example.com/landingpage.php. Now what we are going to do with landingpage.php is simply rotate between the three different landing pages; landingpage.php when you land on it will simply include the different landing pages. Below is the code you'd use for landingpage.php
The PHP Code
<?
//Tracking202 Landing Page Rotation Script
//landing pages filenames, theses will be rotated between eachother
//theses landing pages must be in the same DIRECTORY as this file
//you can add as many landing pages here as you like
$landingpage[1] = 'landingpage1.php';
$landingpage[2] = 'landingpage2.php';
$landingpage[3] = 'landingpage3.php';
//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');
$lpNumber = @fread($fh, 5);
@fclose($fh);
//see which landing page is next in line to be shown.
if ($lpNumber >= count($landingpage)) {
$lpNumber = 1;
} else {
$lpNumber = $lpNumber + 1;
}
//write to the txt file.
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $lpNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);
//include the landing page
include_once($landingpage[$lpNumber]);
//terminate script
die();
?>
Conclusion
So that above code should be placed on landingpage.php; whenever that file is called it will include the other landing pages, and it will rotate between them evenly. Now you are rotating between your landing pages, in Tracking202 when you goto ANALYZE » LANDING PAGES, you can now tell the difference how each individual landing page performs.

Wes (MasterlessSamurai.com) on Aug 25, 2008 at 3:18pm
I wonder if on a future update that this functionality could be coded as part of one of the steps when setting up landing pages. You could have a pull down of sorts, enter in your configuration details, and have the outputted code ready to split test offers.
matt on Nov 14, 2008 at 3:45pm
hey wes, do i need to create new outbound URL's for the offers?...like landingpage2 needs to link to the offer page with a different uRL?
matt on Dec 14, 2008 at 1:45pm
hey guys - will this work for html sites?? - guess integration of php script means changing all to php....!!
Chad on Dec 18, 2008 at 5:15pm
Matt,
you can force your .htm/.html files to be parsed by php if you update your .htaccess to include:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Wes Mahler on Dec 19, 2008 at 2:33am
@Matt 2) Yes you need to setup each landing page with its own outbounds.
@matt 3) You'll want to change it to .php, thats the easiest, or do matt's trick.
Sean on Jan 07, 2009 at 2:43pm
Here's a bit more of a generic version that randomly picks a file in the current directory matching lp_*.php. It's not necessary to cycle in order, nor should it be necessary to specify the list of landing pages in advance.
Call this index.php and put it in your directory, ie /landingpage. Put your individual landing pages in the same directory, make sure they have a .php extension, and begin with lp_.
<?php
/* Landing page rotator
*
* Picks a random landing page out of all the ones in the current directory
* Name your landing pages staring with lp_ and ending with a .php extension
* ie lp_blue.php
*
* Released to the public domain, sean@ertw.com 2009
*/
$lp = glob("lp_*.php", GLOB_NOSORT);
include_once($lp[rand(0,count($lp)-1)]);;
?>
shane on Jan 09, 2009 at 1:09pm
what about setting a cookie to make sure the same landing page is served up when they return? not everyone performs your desired action on the very first visit
primesgenato on Jan 10, 2009 at 12:53pm
@Wes
Reading and writing to a file just to determine what LP to show gives BIGTIME overhead for your server. No problem if your traffic is small but if you have many thousands of hits, then your solution isn't very efficient. Multiple processes hitting your page at the same time will also be forced into a wait condition simply because only 1 thread can read/write your "count.txt" file at the same time.
@Sean
Your solution is better, though there is still unnecessary overhead because it forces the server's underlying OS to do a file search based on your "*" wildcard. It also forces me to name my LPs in a certain way and to be in the same directory. I personally just have an array of URL LPs which can have any name I want, and be in any location, even on another server. I then use the "array_rand()" function to pick a random LP to show.
##################################################
# Array of LPs
$lps = array(
'path/to/lp/hoodia.php',
'path/to/lp/in/same/server/acai.php',
'http://externalserver.com/greentea.php',
);
header('Location: ' . array_rand($lps));
##################################################
@shane
Good idea! You're right. I never thought about that. :)
Wes Mahler on Jan 10, 2009 at 3:58pm
@primesgenato agreed, but it was really the easiest way to set it up so it'd rotate evenly without much work or SQL's being needed.
affiliate software on Jan 13, 2009 at 1:07am
so where does this stand? whats the leanest/meanest way to rotate and spit test?
wes, if my dedicated server is getting under 20k a day to it, is this script y0u have provided ok to use?
thx
primesgenato on Jan 13, 2009 at 11:55am
@affiliate software
Using my script is MANY MANY MANY times faster than Wes's or even Sean's script. This is because no additional overhead is incurred in calling the server OS to read/write files/directories.
But if you've got a dedicated server with plenty of resources to spare, then you can afford to choose any split testing script you want. Should not be a problem if it's less than 20k. Though I'm assuming it's spread out evenly throughout the day, and not all 20k hits in an hour!
Just monitor your server usage daily to see if they're being maxed out. Or check with your support techs if you wanna be sure your server is holding up alright. :)
Steffen on Feb 06, 2009 at 8:13am
@primesgenato:
There is a error in your script. It should look like this:
#########################
$lps = array(
'1.html',
'2.html',
'3.html',
);
header('Location: ' . $lps[array_rand($lps)]);
#########################
array_rand returns the array element number.
Jimmy on Feb 06, 2009 at 12:12pm
How can I use primesgenato script to track keywords?
Yacobi on Feb 07, 2009 at 7:13am
I've created a version combining the best of the versions above - performance, simplicity and not using a redirect so the referrer and parameters won't be lost. Tried it with html also and it worked:
<?
//Tracking202 Landing Page Rotation Script
//landing pages filenames, theses will be rotated between eachother
//theses landing pages must be in the same DIRECTORY as this file
//you can add as many landing pages here as you like
$landingpage[1] = 'LandingPage1.php';
$landingpage[2] = 'LandingPage2.php';
$lpNumber = rand(1,count($landingpage));
//include the landing page
include_once($landingpage[$lpNumber]);
//terminate script
die();
?>
primesgenato on Feb 11, 2009 at 4:28am
@Steffen
Good call! I just typed out the code without checking the syntax for correctness. Sorry about that.
Sean on Feb 16, 2009 at 10:15am
@primesgenato
If you're worried about the syscalls associated with the glob, then you've got problems. strace apache some day and you'll see all the stuff that goes on behind the scenes, this is nothing compared to the existing overhead, especially if the request goes to the PHP module.
Your points about the LP needing to be in the same directory are of course very valid. My approach has been to fit my workflow around this limitation.
Anyway, rather than speculate, I put both my script and yacobi's on my workstation and ran ab against it. The results are virtually identical on my PC, which is not at all tuned for the load. If I used 500 landing pages in my solution I could make it worse, but with 10 LPs there was no discernible difference.
YYMV, IMHO, etc.
Logan on Feb 16, 2009 at 6:14pm
Maybe I am missing something, but what landing page do I then select when in the "Get links" area of prosper202 to create my link to give to Google AdWords? Do I setup my index page as a landing page as well? For your example, the landing pages created would be:
landingpage1.php
landingpage2.php
landingpage3.php
index.php
Or is there something else I would do?
Thanks.
Wes Mahler on Feb 17, 2009 at 1:39am
@Logan, making an index.php file would be a good idea, yes that should work!
and then it'll rotate between ur landingpage1-3.php
chris on Feb 18, 2009 at 11:13am
Hey did anyone come up with anything to solve shanes query on the same landing page coming up if a user returns?
Thanks.
albonya on Feb 19, 2009 at 9:48pm
2 Questions:
1. How do you test this to make sure it's rotating properly?
2. For the separate outbound redirect pages, do we also need to create separate versions of the offers in Tracking202 so that the redirect codes are different for each landing page?
Steven on Feb 20, 2009 at 3:38am
@Chris - not at the current moment but we'll be releasing something in the future for Pro on this
@Albonya - You would need to enter the rotate.php script into a browser and make sure its evenly rotating through the pages and that the hits are showing up in SPY. As for the outbound, if its using the rotate script and is on the same domain, you just need to add the exact URL structure for LP setup.
rideswitch on Feb 25, 2009 at 1:44pm
@Steffan
I used your script to rotate my landers on wordpress. What effect would a redirect have on t202? Is there any? Your's was the most simple and quickest code, why were other people discussing "includes" if a simple redirect works well?
#########################
$lps = array(
'1.html',
'2.html',
'3.html',
);
header('Location: ' . $lps[array_rand($lps)]);
#########################
Thanks, RideSwitch
Dan on Feb 28, 2009 at 2:07pm
If you are using iframes... this doesn't seem to work. I am not the coder, but is there something I can change to make that work?
These are multiple iframed offers and I am trying to rotate them.
Thanks
dave on Mar 11, 2009 at 10:52pm
how would you do this if you want to test out your home page which happens to be a forced optin page?
if you're ranking for seo how would this play in?
ImagesAndWords on Apr 25, 2009 at 12:52pm
I wrote up a more detailed tutorial on how to set this up here: http://profitapolis.com/featured/how-to-split-test-landing-pages-with-tracking202.html
Dean on Aug 06, 2009 at 3:37am
What code to add to the script if we want it to rotate our landing pages after 10 times of impression for each?
Wini on Aug 10, 2009 at 11:36am
I've just setup my landing page split test as above - it works fine. But the question is now:
If I'm going to buy traffic I must setup a PPC campaign and associate this with one special affiliate network/campaign but I'm split testing with different networks and merchants (I'm doing not only landing page split test also offer rotation).
Are the traffic costs calculated correctly if I do a split test this way?
Yebot on Aug 13, 2009 at 1:30pm
Someone asked about using cookies to show the same LP to the same user if they come back later. Here's how that might look:
http://snipt.org/lmV
Other mods:
-- set how long until cookie expires
-- uses a header redirect instead of an include
Kris - Cashtactics.net on Aug 29, 2009 at 12:20am
Yebot
Did you code that up yourself?
Mac_User on Sep 07, 2009 at 3:32pm
I'd like to utilize this script for my PPV offers. Is there any way in prosper202 to monitor actual page clicks on the landing page. With PPV, the landers are automatic clicks (almost like an impression) that are shown to the user. When a user clicks on the "submit button" on a lp, there is no way to follow the clicks other than to go the network to see the clicks and conversions (of course in p202, you will also see conversions due to pixel tracking).
Any thoughts...
Magnus on Sep 16, 2009 at 9:44pm
Hello, Maybe I should check the forums for the answer to this... but figured I would post my experiences here.
I have setup everything correctly and have now tried all 3 versions of the rotate script... mentioned above. starting with the first.
The reason why I tried the others is because I was running into the following issue... and still am.
The pages rotate just fine, but when i click on one of the links it is adding an incremental number to the end of the domain making the destination of the redirect fail to load...
I'm guessing that this is the 'count' this should probably be reporting to the count.txt file? I really don't know...
I'm unable to execute 777 files so my server admin told me to set the count.txt file to 644 and said it should be fine...
So In an effort to get around the count.txt file i tried using the code by Yacobi above... which appears to not use the count.txt file, yet I'm still getting the incremental number at the end of each redirected destination url...
any suggestions?
it just dawned on me that this may be the cloaked subid information...
For my offer affiliate link I put my own url because i'm using an iframe for the offer lander...
In this case. what is the correct setup?
Martin P. on Sep 25, 2009 at 7:35pm
Hey, I'm trying the code in my wordpress blog. It works fine but I am using GeoIP on my page and when I use the rotate.php to rotate the pages (because they are pages in WP) it is not showing anymore my city (Montreal) but Houston !! I guess because my server (HostGator) is located in Houston.
Do you know how I can fix that ??
Devon on Oct 16, 2009 at 12:39pm
If we're rotating between Advanced LP's and Simple LP's - Which "Get Links" do we use since it asks for Simple or Advanced? My split testing script will be displaying both simple and advanced....
Bob on Nov 04, 2009 at 5:53pm
@Yacobi
Thanks for sharing your script... but It's not rotating evenly... it sometimes takes 2 or more clicks before it moves to the next page...
The original script above doesn't work, does anyone have a fix for it please?
Thanks
Bob