Hello All,
I am testing 3 pages, and have found a script to rotate between the 3 pages. These are the pages people see after they have opted into a squeeze page.
What I would like to do is record in a text file how many times each thank-you page has been "hit".
This is the script I have:
<?
//enter your affiliate urls below, you can enter as many as you want, please
//make sure that you have the affiliate url with the SUBID syntax at the end
//of it, for reference goto: subids.com for more information.
$offer[1] = 'http://urlthankyou1.html';
$offer[2] = 'http://urlthankyou2.html';
$offer[3] = 'http://urlthankyou3.html';
//this is the text file, which will be stored in the same directory as this file,
//count.txt needs to be CHMOD to 777, full privlledges, to read and write to it.
$myFile = "count.txt";
//open the txt file
$fh = @fopen($myFile, 'r');
$offerNumber = @fread($fh, 5);
@fclose($fh);
//see which landing page is next in line to be shown.
if ($offerNumber >= count($offer)) {
$offerNumber = 1;
} else {
$offerNumber = $offerNumber + 1;
}
//write to the txt file.
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $offerNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);
//redirect to the affilate url, + add the subid at the end
header('location: ' .$offer[$offerNumber]);
?>
At the moment it just records the last offer number it seems.
What do I need to do to get it to record the actual number of times each offer is viewed?
Is there a way of also getting it to record the number of times the offer is uniquely viewed?
Thanks for any help. Hopefully this is an easy one for you guys - I think the "write to the txt file" part of the script needs to be altered, but my php is a little rusty!
Regards
Frank