Script to split-test affiliate offers

Status
Not open for further replies.

ubaidabcd

Banned
Dec 12, 2006
1,030
7
0
Smaxor, provided this script to split-test affiliate offers, but I don't know anything about programming, only basic html skills. How does this script work? I tried to copy/paste the top portion to an index.html, and replaced the affiliate links, nothing happened. Changed it to a .php and nothing happened.

Here it is:

If you don’t have simple split testing code here you go. This will just randomly go through your affiliate urls. Then track your offers at your destination for clicks vs. conversions.

<?

$urls = array(
http://www.affiliateurl1.com”,
http://www.affiliateurl2.com”,
http://www.affiliateurl3.com”,
http://www.affiliateurl4.com”);

$url = $urls[array_rand($urls)];
$destination = “Loation: $url”;
header($destination);

?>

Also if you don’t want to redirect you can just replace that last line with an iframe and remove the destination line.

The iframed version:

<?

$urls = array(
http://www.affiliateurl1.com”,
http://www.affiliateurl2.com”,
http://www.affiliateurl3.com”,
http://www.affiliateurl4.com”);

$url = $urls[array_rand($urls)];

echo “<meta http-equiv=’refresh’ content=’0; $url’>”;

?>
 


Code:
<?php

$urls = array(
“http://www.affiliateurl1.com”,
“http://www.affiliateurl2.com”,
“http://www.affiliateurl3.com”,
“http://www.affiliateurl4.com”);

$url = $urls[array_rand($urls)];
$destination = “Location: $url”;
header($destination);
die();
?>

Try that. Check error_log for errors. Use .php (ofcourse)..
 
where can I find "error_log", sorry like I said I'm dumb to programming (just about everything honestly), I tested this on my computer, should I upload this first and the error log is supposed to show up in my website directory? I'll try that and see what happens
 
This is the error I got:

Parse error: parse error, unexpected ':', expecting ')' in /home/content/u/b/a/ubaidabcd/html/xxxxxx/test/index.php on line 4
 
Dude, if all else fails, write two (or more) identical ads in whatever PPC program you're sending traffic from (ie. Google, YSM, Adbrite, etc.) and use two diff. destination URLs. Theoretically, they will have the same CTR and will be displayed evenly.
 
Dude, if all else fails, write two (or more) identical ads in whatever PPC program you're sending traffic from (ie. Google, YSM, Adbrite, etc.) and use two diff. destination URLs. Theoretically, they will have the same CTR and will be displayed evenly.

Obviously if I could do that easily and quickly I would.

Problem is, I have about 10+ ad groups in each campaign, most have 5+ ads. So that's atleast 50 urls I have to edit on Yahoo's slow ass interface. Then, I have about 3 or 4 offers I need to split-test with this particular campaign. I really don't want to go through changing urls 200 times.
 
change the : to ) on line four...post all your code so we can see.


Ok, sorry as I said I'm dumb to this, which one is line 4? Should I use the updated code by wesley, or the original code I posted.

Here's what I tested and got that error from:

<?php

$urls = array(
http://www.google.com”,
http://www.yahoo.com”,
http://www.ask.com”,
http://www.looksmart.com”);

$url = $urls[array_rand($urls)];
$destination = “Location: $url”;
header($destination);
die();
?>
 
Code:
<?php
$urls = array(
"http://www.google.com",
"http://www.yahoo.com",
"http://www.ask.com",
"http://www.looksmart.com");

$url = $urls[array_rand($urls)];
$destination = "Location: $url";
header($destination);
die();
?>

Try that. I changed the quotes to PHP quotes. It was messed up because of the blog formatting.
 
  • Like
Reactions: ubaidabcd
Code:
<?php
$urls = array(
"http://www.google.com",
"http://www.yahoo.com",
"http://www.ask.com",
"http://www.looksmart.com");

$url = $urls[array_rand($urls)];
$destination = "Location: $url";
header($destination);
die();
?>
Try that. I changed the quotes to PHP quotes. It was messed up because of the blog formatting.


THANK YOU!!!

+ REP!!!!!!!!!
 
Try that. I changed the quotes to PHP quotes. It was messed up because of the blog formatting.

Ok you've helped enough as it is, but I hope I'm not asking too much if you or somebody else could help me with this additional problem.

I don't have a landing page for these particualr offers and I'm trying to keep track of converting keywords, so I'm using Keyword Radar.

So, I have a redirect page from Keyword Radar that captures the keyword and then sends them to the affiliate offer.

How can I combine the above "split-testing aff offer" with my keyword tracking script? If you need to know what my Keyword radar script is:

<HTML>
<HEAD>
<TITLE>Enter Your Title</TITLE>
<meta name="description" content="Enter Your Content">
</HEAD>

<BODY BGCOLOR="#FFFFFF">
<input type="hidden" id="thetrackingid" value="keywordradartrackingid">
<div align="center">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><img src="loadinganimation.gif" /> </p>
</div>
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
function redir()
{
var sTrackingID = document.getElementById("thetrackingid").value;
var sLocation = "http://www.youraffiliatemerchantpage.com?tid=" + sTrackingID;
document.location=sLocation;
}
</SCRIPT>
<!--
XXXXXXXXXXXXXXXXX ENTER KEYWORD RADAR TRACKING SCRIPT HERE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//-->
<script type="text/javascript">
window.setTimeout( "redir()",5000);
</script>
</BODY>
</HTML>


Or would this not work?


THANKS!
 
Status
Not open for further replies.