How Do I Track Click Through A Meta Redirect?

blackxxxer

BANNED
Joined
Oct 29, 2008
Messages
136
Reaction score
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:D
 
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:D

I usually just write it to a log file prior to refreshing using PHP. Here is a sample of how to do it. This will give you a log with DATE,REFERRER,IP.
Code:
<?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);
?>

You can PM me if you need any help with this.

Hope that helps!
 
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
 
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

That'll work as well. My recommendation would be to protect the .htm file above or the .txt file in my code earlier with a .htaccess file so not everyone can view it, unless you don't mind sharing your stats with the world.

I usually create a "logs" directory and send all stats I gather to this directory, then simply protect that directory with a password.
 
Back
Top