B
B
bro-dev2015-10-29 21:32:47
Software testing
bro-dev, 2015-10-29 21:32:47

An AB testing tool?

At the moment there are 3 folders with a site in different types, tell me how to set up traffic distribution evenly, and so that the same user sees only one version of the site. I will collect statistics using Yandex metrics.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bro-dev, 2015-10-29
@xPomaHx

It seems that I found something in php on the test, I'll write it off later

<?php
$id_test='1'; //id теста (при запуске нового теста смените цифру на любую другую)
$count=0;
 
$my_url[$count++]='http://lozyuk.ru/marketing/ab-test/';
$my_url[$count++]='http://lozyuk.ru/tag/ab-test/';
 
// код ниже лучше не трогать
$counterfilename='counter'.md5($SCRIPT_NAME).'.txt';
$cookiename='splitpage'.$id_test.md5($SCRIPT_NAME);
if (!isset($_COOKIE[$cookiename]))
{
  @ $splitpage=file_get_contents($counterfilename);
  $splitpage=intval($splitpage)+1;
  if ($splitpage>=$count) $splitpage=0;
  $f=fopen($counterfilename,'w+');
  fputs($f,strval($splitpage));
  fclose($f);
  setcookie($cookiename, $splitpage, time()+2592000);
} 
else 
  $splitpage=$_COOKIE[$cookiename];
if ($_SERVER['QUERY_STRING'] != '') 
  $my_url[$splitpage].= '?'.$_SERVER['QUERY_STRING'];
Header('Location:'.$my_url[$splitpage]);
exit;
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question