Thanks that really hit the spot, worked straight off and I'll be building on
it.

Nick

> Here's a spin on Bob's approach:
> 
> An include at the top of index.php
> 
> start -------------------------------------------------------------
> $host = isset($REMOTE_HOST) ? $REMOTE_HOST : $REMOTE_ADDR;
> 
> //insert info
> $Query = "INSERT INTO activity_log ";
> $Query .= "(Day, Hour, Browser, Version, Platform, Referer, Time, Screen,
> Department, Item, SID, Search, Basket, User) ";
> $Query .= "VALUES ('" . date('Ymd', mktime()) . "', '" . date('H',
> mktime()) . "', ";
> $Query .= " '$Browser_Name', '$Browser_Version', '$Browser_Platform', '" .
> $host . "', '" . time() . "', ";
> $Query .= " '$SCREEN', '$department', '$item', '$sid', '$inputKeywords',
> '$sku', '" . $UserInfo['ID'] . "') ";
> if(!($DatabaseResult = mysql_query($Query, $DatabaseLink)))
> {
> $ActionResults[] =  mysql_errno() . ": " . mysql_error();
> $ActionResults[] =  $Query;
> }
> stop -------------------------------------------------------------
> 
> the DB looks like this:
> 
> CREATE TABLE activity_log (
> Day int(11) DEFAULT '0' NOT NULL,
> Hour int(11) DEFAULT '0' NOT NULL,
> Browser varchar(8) DEFAULT 'OTHER' NOT NULL,
> Version float DEFAULT '0' NOT NULL,
> Platform varchar(8) DEFAULT 'OTHER' NOT NULL,
> Referer varchar(40) NOT NULL,
> Time int(11) DEFAULT '0' NOT NULL,
> Screen text NOT NULL,
> Department int(11) DEFAULT '0' NOT NULL,
> Item int(11) DEFAULT '0' NOT NULL,
> SID varchar(25) NOT NULL,
> Search varchar(35) NOT NULL,
> Basket varchar(25) NOT NULL,
> User int(5) DEFAULT '0' NOT NULL
> );
> 
> Then you can do reports like this:
> 
> start------------------------------------------------
> $Query = "SELECT Screen, count(*) AS count ";
> $Query .= "FROM activity_log ";
> $Query .= "WHERE Screen != 'user_activity' ";
> $Query .= "GROUP BY Screen ORDER BY count DESC";
> if ( !($DatabaseResult = mysql_query($Query, $DatabaseLink)) ) {
> print(" " . mysql_errno() . ": " . mysql_error() .  "Query was $Query\n");
> } else {
> 
> print "<table border='0'>\n";
> print "<th>\nScreen Title</th>\n";
> print "<th>\nScreen</th>\n";
> print "<th>\nHits</th>\n";
> $row_no = "1";
> 
> while($DatabaseRow = mysql_fetch_array($DatabaseResult)) {
> 
> $Screen = $DatabaseRow['Screen'];
> $ScreenTitle = $ScreenInfo[$Screen][0];
> $Qty = $DatabaseRow['count'];
> 
> if ($row_no % 2 == 0) {
> $bg_clr = '#FFFFFF';
> } else {
> $bg_clr = '#EEEEEE';
> }
> 
> print "<tr bgcolor='$bg_clr'>\n";
> print "<td>\n &nbsp;$ScreenTitle &nbsp; </td>\n";
> print "<td>\n &nbsp;$Screen &nbsp; </td>\n";
> print "<td>\n &nbsp;$Qty &nbsp; </td>\n";
> print "</tr>\n";
> 
> $row_no++;
> 
> }
> 
> print "</table>\n";
> }
> stop--------------------------------------------------------
> 
> There are a number of reports that you can create from the information being
> collected. If you do a query on the items, the type of things users are
> searching...the list goes on. A cron job would also be useful to delete old
> records.
> 
> ron
> 
> 
> 
>> Thanks Bob that's the kind of thing I was thinking about.
>> 
>> Leon's suggestion about altering the URL and tracking via a "fake log file
>> using Apache" is probably a good one if I had that kind of server access.
> In
>> fact I was reading an article: http://www.alistapart.com/stories/urls/
> about
>> just that kind of thing.
>> 
>> Anyway, I've got a few more things to be getting on with before that so
>> thanks again.
>> 
>> Nick
>> 
> 
> 
> 
> 
> ------------------------------------------------------------
> To subscribe:    [EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> Site:            http://www.working-dogs.com/freetrade/
> Problems?:       [EMAIL PROTECTED]
> 
> 



------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to