blackxxxer
BANNED
- Oct 29, 2008
- 136
- 57
Does anyone know how to track clicks & referral through a page with a meta redirect? Can this be done through Google Analytics or would you recommend something different?
Thanks
Thanks
Does anyone know how to track clicks & referral through a page with a meta redirect? Can this be done through Google Analytics or would you recommend something different?
Thanks![]()
<?php
$myLogFile = "./log/mylogfilename.txt";
$refData = $_SERVER['HTTP_REFERER'];
$ipaddr = $_SERVER['REMOTE_ADDR'];
$fh = fopen($myLogFile, 'a') or die("can't open log file");
$stringData = date("c").",".$refData.",".$ipaddr."\n";
fwrite($fh, $stringData );
fclose($fh);
?>
<?php
$ip = $_SERVER['REMOTE_ADDR']; //Get the ip address.
$agent = $_SERVER['HTTP_USER_AGENT']; //Get the user agent.
$ref = $_SERVER['HTTP_REFERER']; // Referer information.
$date = date("H:i dS F"); //Get the date and time.
$file = "log.htm"; //Where the log will be saved.
$open = fopen($file, "a+"); //open the file, (log.htm).
fwrite($open, "<b>IP Address:</b> " .$ip . "<br/>"); //print / write the ip address.
fwrite($open, "<b>Referer:</b>". $ref . "<br/>"); //print / write the referer.
fwrite($open, "<b>UserAgent:</b>". $agent. "<br/>"); //print / write thier useragent.
fwrite($open, "<b>Date & Time:</b>". $date. "<br/>"); //print / write the date and time they viewed the log.
fclose($open); // you must ALWAYS close the opened file once you have finished.
?>
you can also try this:
PHP:<?php $ip = $_SERVER['REMOTE_ADDR']; //Get the ip address. $agent = $_SERVER['HTTP_USER_AGENT']; //Get the user agent. $ref = $_SERVER['HTTP_REFERER']; // Referer information. $date = date("H:i dS F"); //Get the date and time. $file = "log.htm"; //Where the log will be saved. $open = fopen($file, "a+"); //open the file, (log.htm). fwrite($open, "<b>IP Address:</b> " .$ip . "<br/>"); //print / write the ip address. fwrite($open, "<b>Referer:</b>". $ref . "<br/>"); //print / write the referer. fwrite($open, "<b>UserAgent:</b>". $agent. "<br/>"); //print / write thier useragent. fwrite($open, "<b>Date & Time:</b>". $date. "<br/>"); //print / write the date and time they viewed the log. fclose($open); // you must ALWAYS close the opened file once you have finished. ?>
it will log IP of user, useragent (IE,FF,etc), referer, date and time.
it will be written to log.htm which is easy readable by your browser.
the code is placed above the meta refresh