homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
Forum Library, Charter, Moderators: Receptional & mademetop

Website Analytics - Tracking and Logging Forum

Log files with Javascript.

 3:58 pm on Nov 25, 2007 (gmt 0)

I saw this on this thread [webmasterworld.com...]

$uri = "http://www.mysite.com" . $_SERVER['REQUEST_URI'];
$dtime = date('r');

$line = "$unixtime;$dtime;$ip;$uri;$ref";

$f = fopen("log.log", "a");

@fwrite($f, $line . "\n");

and I've got this working in a fuction in an includes file but how could i do the same with javascript? so I could enter a piece of javascript. in each file?

Thank you.



 9:24 pm on Nov 30, 2007 (gmt 0)

You can't write to the server with javascript. At best, you can use Javascript to submit data to a server side script (using PHP, ASP, or some other language) and write to the filesystem in that language. But that goes beyond your basic logging. You should restrict Javascript logging to capturing data in the browser that the server can't catch on it's own, and for use with third party solutions (like Google Analytics). Just use a server side script or your server logs.

If you can't see your log and you can't use server side scripting, change your web host.

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved