Jump to content

Help! Rotator script - An Easy One For You Guys?


frankmill

Recommended Posts

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

Link to comment
Share on other sites

Perhaps it would make sense to use Google analytics for keeping track of the analytics portion of this? I think that would be a much more cost-effective option, since you wouldn't have to write everything yourself and it would take care of tracking page views/unique page views.

 

 

Thanks Ben - I have done just that. Don't know why I didn't think of this before!

 

 

However - just in the interest of not being too dependant on Google, and also of just knowing how to do it - isn't there a simple way of adjusting this code?

 

 

Frank :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...