Skip to content

Instantly share code, notes, and snippets.

@timelf123
Forked from underdown/gist:2141741
Created October 8, 2012 04:19
Show Gist options
  • Save timelf123/3850699 to your computer and use it in GitHub Desktop.
Save timelf123/3850699 to your computer and use it in GitHub Desktop.
Split test only new visitors
<?php
setcookie("BTDT", "1", strtotime("+30 days"));
if(!$_COOKIE["BTDT"]) {
if($_GET["gclid"]) {
switch(rand(1,3)) {
case 1: header("location: /a/index.php");break;
case 2: header("location: /a/index2.php");break;
case 3: header("location: /a/index3.php");break;
}
}
}
?>
@onlinemarketresults
Copy link

this will set a cookie on new visit, and if the cookie is not set, will check for a gclid from adwords for split testing landers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment