GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Any PHP Guys here tonight? Quick Question... (https://gfy.com/showthread.php?t=929167)

qxm 09-21-2009 11:35 PM

Any PHP Guys here tonight? Quick Question...
 
I need to test 3 landing pages with one domain... I currently have a simple php "if > else" statement on index.php that sends 50/50 to each LP .. here it is:

PHP Code:

<?php
if(rand(0,1) == 0) {
header("Location: http://www.domain.com/landingpage1.html");
} else {
header("Location: http://www.domain.com/landingpage2.html");
}
?>

I was wondering how to ad a third page in there or if I have to change to an array type of thing.... .I was googling this stuff but couldn't find something other than a 50/50 split test...

What I am trying to avoid is to use a dynamic link such as domain.com/?id=landing1.html to test these 3 pages.. .instead I'd like to send traffic to domain.com and have some php code split the traffic...

Any ideas? ...




</NO trolls pls I am workin late and don't have time for ur shit, thanks>

alexwoj 09-21-2009 11:43 PM

Hello!

I dont know if you wan't to try conversions. But if the answer is YES, you can try google optimizer. I have used it to test 5 tours, and it told me the tour that converted better for my paysite. You configure the tours, and the goal. It will tell you the tour that sends more users to the goal page.

Search for google optimizer and try it.

Sorry, cannot help you with the PHP code right now, because I am drinking some whisky and its almost 4 AM. But if you dont find any answer please PM me and tomorrow I can help you. And try google optimizer.


See ya

Alex

GrouchyAdmin 09-21-2009 11:47 PM

Here's a real simple way to do it:

Code:

<?php
$urlArray = array(
  "http://whatever",
  "http://whatever",
  "http://whatever",
  "http://whatever",
  "http://whatever",
  "http://whatever",
  "http://whatever",
);

header("location: ".$urlArray[mt_rand(0, count($urlArray)-1)]);
?>

This doesn't do that great for weighting.

If you want to do some weighting, some pseudo code (ugly) could be as follows:

Code:

$count = ceil(100/count($urlArray));
$randchoice=rand(count($urlArray)%$count,0)-1;

Never did bother checking the graulatity of the above code snippit in practice, though, though. It should give roughly an even (rounded up) percentage to either one, since PHP's rand() tends to suck with smaller subsets.

Make DAMN sure you just use a location: redirect, which is a 301. Google won't penalize you for those.

2012 09-21-2009 11:47 PM

$link1='<somewhere>';
$link2='<somewhere>';
$link3='<somewhere>';

function getRandom(){
$r=rand(1,3);
return $r;
}

switch (getRandom()) {
case 1:
$theLink=$link 1;
break;
case 2:
$theLink=$link2;
break;
case 3:
$theLink=$link3;
break;
}

header $theLink

plsureking 09-21-2009 11:48 PM

just make rand a variable before your if statement. u can also use switch instead of if to make it easier to add more options.

qxm 09-22-2009 12:12 AM

thanks Grouchy/Fartfly .... I'll try those out... :)


All times are GMT -7. The time now is 03:43 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123