Home > Tracking Campaigns > CPV Lab Pro

How to Hack Your Own Multivariate Test in CPV Lab (4)


10-28-2013 04:39 PM #1 andyvon (AMC Alumnus)
How to Hack Your Own Multivariate Test in CPV Lab

As I was not too happy about the CPV Lab integration of LPG, especially the fact that you had to mess around with your campaign and LP setup in order for it to work, I decided to hack together my own little multivariate tester.

It turned out pretty well, so I decided to share it with you guys.

DISCLAIMER: In order to get this hack to work, you should have at least basic HTML / PHP skills. Plus, I obviously don't take any responsibility if you break your CPV Lab

The general idea behind this hack is to generate random numbers that determine which variation of your LP will be shown and that will also show up in the CPV Lab stats.

It uses no additional redirects, so you should see no increases in loading time.


Step 1.) Generate random numbers and pass them to CPV Lab

To achieve this, we need to add some code to base.php which is the first file that is called from your campaign URLs.

Unfortunately we can't just add the code to the original file as CPV Lab is encoded with the IonCube Loader and will stop working whenever modifications are detected. This means we will have to make a little workaround:

  1. Rename the "base.php" file (located in the root directory of your CPV Lab installation) to "mybase.php"
  2. Create a new "base.php" file with the following content:

Code:
<?php
if (isset($_GET['v1_count']))
	$v1_count = $_GET['v1_count'];
else
	$v1_count = 1;
	
if (isset($_GET['v2_count']))
	$v2_count = $_GET['v2_count'];
else
	$v2_count = 1;
	
if (isset($_GET['v1_start']))
	$v1_start = $_GET['v1_start'];
else
	$v1_start = 1;
	
if (isset($_GET['v2_start']))
	$v2_start = $_GET['v2_start'];
else
	$v2_start = 1;

$v1 = rand($v1_start, $v1_count);
$v2 = rand($v2_start, $v2_count);

$_GET['v1'] = $v1;
$_GET['v2'] = $v2;	
$_REQUEST['v1'] = $v1;
$_REQUEST['v2'] = $v2;

include('mybase.php');
?>
Obviously you should stop traffic while making these modifications or at least be very quick about it

What this code does is it generates 2 random numbers based on specific start values ($v1_start - $v2_start) and ranges ($v1_count - $v2_count). Afterwards it includes the original base.php (now called "mybase.php") to execute the rest of CPV Labs tracking code.

Step 2.) Implement multiple variations in your LP

This example should give you an idea on how to use multiple variations in your LPs:

Code:
<?php
	$v1_array[1] = "v1_1";
	$v1_array[2] = "v1_2";
	$v1_array[3] = "v1_3";
	$v1_array[4] = "v1_4";
	
	$v2_array[1] = "v2_1";
	$v2_array[2] = "v2_2";
	$v2_array[3] = "v2_3";
	$v2_array[4] = "v2_4";

	$v1_item = $v1_array[$_GET['v1']];
	$v2_item = $v2_array[$_GET['v2']];
?>
<html>
<head>
	<title>Splittester</title>
</head>

<body>
	<p>v1: <?= $v1_item; ?></p>
	<p>v2: <?= $v2_item; ?></p>
</body>

<input type="hidden" id="hidLocation" value="http://trackingurl.com/" />
<script type="text/javascript" src="http://trackingurl.com/landing.js"></script>

</html>
So on top of your LP file you define all the different variations, e.g. $v1_array could have all the different image URLs you want to test and $v2_array different CTAs.

Whenever you want to use one of these values, you echo $v1_item - $v2_item respectively, e.g. "<?= $v1_item; ?>".


Step 3.) Set up Multivariate Test in CPV Lab

Next, you will have to add some extra tokens in your CPV Lab campaign:





Your campaign URL should now look something like this: http://trackingurl.com/base.php?c=12...t=1&v2_start=1

Now you are all set and the variations on your LP should change with each call of the campaign URL.

This is a very basic hack and I am sure that there are a lot of potential tweaks, so feel free to modify it to your liking!


10-28-2013 05:21 PM #2 JasperP (Member)

this is awesome!! great share

Also, I thought about what caurmen said with the redirect in your thread... you could also just create a "separate" base.php so it's not modified

Something like this:

base_dating_campaign.php

Code:
<?php

// Multivariate code here

include('base.php');

?>
then when you get your destination URL, you change it from
Code:
http://mycpvlabtracker.com/base.php?c=123&key=78b9adcd713964848744dda9
to

Code:
http://mycpvlabtracker.com/base_dating_campaign.php?c=123&key=78b9adcd713964848744dda9


10-28-2013 07:21 PM #3 andyvon (AMC Alumnus)

Yeah, that was my original solution, but I wanted to be able to implement it without having to change the target URL of my ads (which, on most traffic sources, would lead to them going into review again), so I decided on changing the name of base.php instead.

Thanks again for your idea of using the include, that's what set off the light bulp in my head ;-)


10-29-2013 04:18 PM #4 caurmen (Administrator)

AWESOME share. Thanks very much! That's very similar to the approach I've used on Prosper in the past - works like a dream.


Home > Tracking Campaigns > CPV Lab Pro