Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

User Tracking with Admin 1.31 Released


Druide

Recommended Posts

:thumbsup: First things first - this is one AWESOME contrib. My hat is squarely doffed and I'm most grateful to the originators and contributors. This contrib filled a need for a client.

 

I third this bug - does anybody have a clue how to fix it? It's pretty useless when you can't view anything other than "today"... :(

 

Jacob

 

 

:angry: I just noticed this same problem with my installation, too. I hate having links that don't do what you want them to do: [view session] = start over at today's date instead of showing the session.

 

Probably better to not have links for past days than to have links that don't do what they advertise.

 

I'm sure that the fix will have to deal with the date. Perhaps one of the more php literate types will take this on and fix this little glitch. Sorry it isn't me.

 

I look forward to a fix to this awesome contrib.

 

Joseph

Steep learning curve? Hell, I don't even know enough to formulate a stupid question!!

Link to comment
Share on other sites

  • Replies 570
  • Created
  • Last Reply

Top Posters In This Topic

Lines in bold were additions to the file. Perhaps someone has already made this modification. If you have, sorry for stepping on your toes... ;)

nice but you can also just make a copy of the user_tracking table and name it user_tracking_searchengines to keep the data seperate ;)

 

and ofcourse copy admin/usertracking.php to user_tracking_searchengines.php and change all table and filename data in it.

 

i changed in admin/user_tracking.php

 

if (($whos_online['full_name'] == "Guest") && ($whos_online['session_id'] == "")) {
? ? ? $user_tracking[$whos_online['session_id']]['full_name'] = '<font color="ff0000"><b>Spider</b></font>';
? ?tep_db_query("INSERT INTO " . TABLE_USER_TRACKING_SEARCHENGINES . " SELECT * FROM " . TABLE_USER_TRACKING . " WHERE session_id = '" . $whos_online['session_id'] . "'");
? ?tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE session_id = '" . $whos_online['session_id'] . "'");
}

 

just to give you an idea

 

 

I'd like to know more about this, not quite sure what to do there. I copied and renamed the dbase and file but not sure what to do next with the above code?

 

Cheers

Link to comment
Share on other sites

  • 1 month later...

That is a well known BUG by me, but i haven't looked into it for a few weeks, i will try to fix it after this weekend

 

I think I sqashed this BUG bug.

On, or near line 329 find:

<a href="user_tracking.php?viewsession="

and change to

<a href="user_tracking.php?time=" . $time_frame . "&viewsession="

I'm looking into the refering URL not showing up. Would this make sense to store in the database? I don't follow what you added to application_top with tep_session_register('refere_url')

I am not familiar with what tep_session_register accomplishes

-Stick

 

This fix was posted on page 10 of this thread. Remembered using it way back then ;) I've made the following change in admin/user_tracking.php about line 223

FROM

<td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b>, ' . $ut['value']['session_id'] . ", <a href=\"user_tracking.php?delsession=" . $ut['value']['session_id'] . "\"><font color=red>[" . TEXT_DELETE_SESSION . "]</font></a>" . ", <a href=\"user_tracking.php?viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . "\"><font color=green>[" . TEXT_VIEW_SESSION . "]</font></a>";?></td>

TO

<td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b>, ' . $ut['value']['session_id'] . ", <a href=\"user_tracking.php?time=" . $time_frame . "&delsession=" . $ut['value']['session_id'] . "\"><font color=red>[" . TEXT_DELETE_SESSION . "]</font></a>" . ", <a href=\"user_tracking.php?time=" . $time_frame . "&viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . "\"><font color=green>[" . TEXT_VIEW_SESSION . "]</font></a>";?></td>

 

I am now able to go back through the days and view/delete sessions. Those that were assigned session id anyway -- still can't use the "delete session" to delete a bot session.

 

Maureen

Link to comment
Share on other sites

This fix was posted on page 10 of this thread. Remembered using it way back then ;) I've made the following change in admin/user_tracking.php about line 223

FROM

<td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b>, ' . $ut['value']['session_id'] . ", <a href=\"user_tracking.php?delsession=" . $ut['value']['session_id'] . "\"><font color=red>[" . TEXT_DELETE_SESSION . "]</font></a>" . ", <a href=\"user_tracking.php?viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . "\"><font color=green>[" . TEXT_VIEW_SESSION . "]</font></a>";?></td>

TO

<td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b>, ' . $ut['value']['session_id'] . ", <a href=\"user_tracking.php?time=" . $time_frame . "&delsession=" . $ut['value']['session_id'] . "\"><font color=red>[" . TEXT_DELETE_SESSION . "]</font></a>" . ", <a href=\"user_tracking.php?time=" . $time_frame . "&viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . "\"><font color=green>[" . TEXT_VIEW_SESSION . "]</font></a>";?></td>

 

I am now able to go back through the days and view/delete sessions. Those that were assigned session id anyway -- still can't use the "delete session" to delete a bot session.

 

Maureen

 

Maureen -

 

Thanks for the heads up on this fix. There is another contribution - Visitor Web Stats - that does pretty much the same thing. I actually like the User Tracking UI a little bit better, but VWS gives you more info, with graphical charts, etc.

 

VWS: http://www.oscommerce.com/community/contributions,949

 

Jacob

Link to comment
Share on other sites

Hello,

I've downloaded version Admin Area Modification v.1.35.. all steps and upload..

when i'm going to User Tracking at Admin i'm receiving:

 

unknown column 'referer_url' w field list

 

select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url, session_id from user_tracking where time_entry > 1113316791 and time_entry < 1113403191 order by time_last_click desc

 

 

hm.. there is no referer_url colum in the dbase.. :'(

 

deleting this referer_url from user_tracking.php select make no error but no tracking..

 

what is wrong, maybe i did some mistake?

 

best regards

Sebastian

Link to comment
Share on other sites

Hello,

I've downloaded version Admin Area Modification v.1.35.. all steps and upload..

when i'm going to User Tracking at Admin i'm receiving:

 

unknown column 'referer_url' w field list

 

select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url, session_id from user_tracking where time_entry > 1113316791 and time_entry < 1113403191 order by time_last_click desc

hm.. there is no referer_url colum in the dbase..  :'(

 

deleting this referer_url from user_tracking.php select make no error but no tracking..

 

what is wrong, maybe i did some mistake?

 

best regards

Sebastian

 

Look up....Post #445 near the top of page 23 answers this.

 

Solution:

Simply add a column to the end of the table named "referer_url", Datatype: "varchar(255)". If you are lazy ;-) you can simply use the following sql-replace of your current table:

 

DROP TABLE IF EXISTS `user_tracking`;

CREATE TABLE `user_tracking` (

`customer_id` int(11) default NULL,

`click_id` int(11) default NULL,

`full_name` varchar(64) NOT NULL default '',

`session_id` varchar(128) NOT NULL default '',

`ip_address` varchar(15) NOT NULL default '',

`time_entry` varchar(14) NOT NULL default '',

`time_last_click` varchar(14) NOT NULL default '',

`last_page_url` varchar(255) NOT NULL default '',

`page_desc` varchar(64) NOT NULL default '',

`referer_url` varchar(255) NOT NULL default ''

) TYPE=MyISAM;

 

-please backup your data first. This version delete all present data.

Link to comment
Share on other sites

I'd like a way in which I can select a date to look at without having to click day-by-day back several months to see what activity a user did on a certain date.

 

I'd just love to see a calendar similar to the one on the "Add New Product" page.

 

If a calendar was showing on the User Tracking page instead of a simple link to yesterday, I'd love it even more than I do now.

 

This is one AWESOME contrib. Thanks!!

 

:thumbsup:

Steep learning curve? Hell, I don't even know enough to formulate a stupid question!!

Link to comment
Share on other sites

Sorry if I annoy anyone who has already posted the answer to this.

But after 11 pages i went cross eyed.

 

I love this contribution however I can not see what is in the customers cart.

It always says "Session Expired"

 

And the referer_url has never worked.

 

The user_cart is more important to me as I also use a live chat system for support and would like to actually see what they have in the shopping basket.

 

Please email your response as well as post to [email protected] as I may not be able to find this post again.

 

Thanks

Link to comment
Share on other sites

Sorry if I annoy anyone who has already posted the answer to this.

But after 11 pages i went cross eyed.

 

I love this contribution however I can not see what is in the customers cart.

It always says "Session Expired"

 

And the referer_url has never worked.

 

The user_cart is more important to me as I also use a live chat system for support and would like to actually see what they have in the shopping basket.

 

Please email your response as well as post to [email protected] as I may not be able to find this post again.

 

Thanks

 

I've got the exact same issue so a suggestion here would probably be the most helpful.

Link to comment
Share on other sites

I've got the exact same issue so a suggestion here would probably be the most helpful.

 

I think we are all alone mate.

 

I really appreciate a good contribution but not when you expect one thing, take the time involved in loading it and find it does not do what you wanted.

 

This is pointless.

Link to comment
Share on other sites

Hmmm. I've just upgraded my previous version of UT (no ..not Unreal Tournament) to the latest version 1.35.1.

 

:'(

 

The referer_url correction is NOT working as the field in the table UT is not filled up in function tep_update_user_tracking(). It can still be pulled from the sessions table however but you will onyl have the referers of the open sessions. That's the bug that should have been fixed.

 

I will have a look at it...

 

Otherwise, the delete sessions, time diffs, etc. are fixed. A minor bug is the fact that MIN_CLICK_COUNT is not defined. Just add a line like

 

$MIN_CLICK_COUNT = 1

 

and you will not display one-page visits.

 

Didier.

Link to comment
Share on other sites

This is the change to perform in file "functions/user_tracking.php", function tep_update_user_tracking() :

 

Replace the insert SQL at the end of that function by

 

tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, referer_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $referer_url . "', '" . $page_desc . "')");

 

This will insert the referer URL in the table user_tracking.

 

Second change to do in file "admin/user_tracking.php" :

 

put in comment the line (~218)

 

$referer_url = "";

 

Try this and if it works, I will update the contribution with a new version.

 

Didier.

Link to comment
Share on other sites

Here you can find a new version of the User Tracking contribution v1.36 with some enhancements and bug fixing.

 

This is the changelog for version 1.36 :

 

- added some missing flags in admin/images/flags

- added constant MIN_CLICK_COUNT. It has been initialised to "1" so click counts = 1 are not displayed

- added "$time_frame" on delete and view session php call (bug report by Maureen at 04.04.2005)

- $referer_url put in comment as it is pulled now from the user_tracking table so it must not be set to NULL anymore

- display of entry and end date

- visits like spiders do not have a session_id, so their session was also displayed by default. Bug has been fixed but now it is not possible anymore to view a session without a session_id. I find it not useful to look at >1000 links from a spider visit.

- added some "bold" tags for nicer display

- added correct management of $referer_url

- added "addslashes" php command for the product_name in case you have special characters in the name

- added files catalog/includes/application_top.php and catalog/includes/footer.php

- added file admin/includes/footer.php

 

You can find it here : http://www.oscommerce.com/community/contributions,1055

 

Didier.

Link to comment
Share on other sites

Looks good and useful - but it only seems to show admin users - no customer sessions are displayed at all

 

Any ideas??

 

Cheers

 

You must change in "catalog" folder files application_top.php and footer.php to insert records in table "user_tracking" for each page visit. Install "Query debug" if you want to see your SQL queries.

 

Didier.

Link to comment
Share on other sites

You must change in "catalog" folder files application_top.php and footer.php to insert records in table "user_tracking" for each page visit. Install "Query debug" if you want to see your SQL queries.

 

Didier.

 

 

Thanks for the reply Didier

 

Found the problem - I have the STS template system installed and the last bit of code in footer.php is used by that - I moved your code to just before it and all seems to be working now.

Link to comment
Share on other sites

One more thing....

 

I'm being seached by the msnbot at the moemnt and it's getting to be a long list of pages - can you exclude more than 1 IP address??

 

Or, is it possible to exclude a list of hosts (eg: msnbot.msn.com)

 

Cheers

Link to comment
Share on other sites

One more thing....

 

I'm being seached by the msnbot at the moemnt and it's getting to be a long list of pages - can you exclude more than 1 IP address??

 

Or, is it possible to exclude a list of hosts (eg: msnbot.msn.com)

 

Cheers

 

Not really. This contribution allows to check only 1 IP. You'll have to do changes in function tep_update_user_tracking() in file functions/user_tracking.php.

 

$skip_tracking[CONFIG_USER_TRACKING_EXCLUDED] = 1;

 

Best thing to do is make an array with your IPs that you want to exclude.

 

At the end of this function you can find

 

if ($skip_tracking[$wo_ip_address] != 1)
     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, referer_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $referer_url . "', '" . $page_desc . "')");

 

This has to be changed to compare the $wo_ip_address with the IPs of your array. I have no time however to put up some php code to make this work.

 

Didier.

Link to comment
Share on other sites

Hello,

 

Has anyone figured out the problem with the cart display.

It shows session expired?

 

Is it something to do with the Credit Class Gift Voucher mod.

This changed the cart system to a super_cart.

 

And I am thinking maybe it stores the data in a different sequence in the sql table.

 

Can you help at all, as this would be a great sales tool to see what they have in the cart.

 

This is a example of what my cart looks like in table_sessions (field: value) -

cart|O:9:"supercart":7:{s:8:"contents";a:1:{i:3;a:1:{s:3:"qty";i:1;}}s:5:"total";d:15.5600000000000004973799150320701301097869873046875;s:6:"weight";d:0.2;s:6:"cartID";s:5:"01034";s:12:"content_type";b:0;s:13:"total_virtual";d:15.5600000000000004973799150320701301097869873046875;s:14:"weight_virtual";d:0.4;}language|s:7:"english";languages_id|s:1:"1";currency|s:3:"AUD";navigation|O:17:"navigationhistory":2:{s:4:"path";a:3:{i:0;a:4:{s:4:"page";s:9:"index.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:0:{}s:4:"post";a:0:{}}i:1;a:4:{s:4:"page";s:16:"product_info.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:2:{s:11:"products_id";s:1:"3";s:6:"action";s:11:"add_product";}s:4:"post";a:3:{s:11:"products_id";s:1:"3";s:1:"x";s:2:"31";s:1:"y";s:2:"14";}}i:2;a:4:{s:4:"page";s:17:"shopping_cart.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:0:{}s:4:"post";a:0:{}}}s:8:"snapshot";a:0:{}}affiliate_ref|N;affiliate_clickthroughs_id|N;

 

And the cart holds product_id = 3 and it is $15.56 after tax and is called a Flexible Wrist Band.

 

I cant seem to understand how it decodes this, so I am hoping a genious on here will help me.

Link to comment
Share on other sites

Hi Curtis,

 

I also have the Gift voucher system installed and this mod works very well with it. It does not change th cart system but it adds its values in the session registers of course. The value you have in the session table holds the values of all global registers set during the client's visit. It is hard to de-code but I have the same thing so I guess the problem is not here.

 

The cart contents is only available during the session. Best thing is to debug the code in admin/user_tracking.php and see what is going on when you put something in the shopping cart :

 

// shopping cart decoding
   $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $ut['value']['session_id'] . "'");
   if (tep_db_num_rows($session_data)) {
     $session_data = tep_db_fetch_array($session_data);
     $session_data = trim($session_data['value']);
   } else {
     $session_data = @file(tep_session_save_path() . '/sess_' . $ut['value']['session_id']);
     $session_data = trim($session_data[0]);
   }   
   $cart = "";
//    $referer_url = "";
   $num_sessions ++;
   session_decode($session_data);
   
   $contents = array();
   if (is_object($cart)) {
     $products = $cart->get_products();
     for ($i=0; $i<sizeof($products); $i++) {
       $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']);
     } 
     if (sizeof($products) > 0) {
       $contents[] = array('text' => tep_draw_separator('pixel_black.gif', '100%', '1'));
       $contents[] = array('align' => 'right', 'text'  => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency));
     } else {
       $contents[] = array('text' => ' ');
     }
   }

 

Did you change something in the function get_products() maybe ? Is $cart filled up ?

 

Didier.

Link to comment
Share on other sites

Anyone have any interest in having a report for the referring url?

I was thinking of creating a report that would create a table like:

 

Google:

# of Hits

keyword/phrases

Froogle:

# of Hits

keyword/phrases

MSN:

# of Hits

keyword/phrases

etc.

That way you can track how users are searching, and what types of hits are coming from paid links. I like awstats for general web stats, but thought of implementing something for using this contrib. for something easier than logs.

Link to comment
Share on other sites

Anyone have any interest in having a report for the referring url?

I was thinking of creating a report that would create a table like:

 

Google:

      # of Hits

      keyword/phrases

Froogle:

      # of Hits

      keyword/phrases

MSN:

      # of Hits

      keyword/phrases

etc.

That way you can track how users are searching, and what types of hits are coming from paid links.  I like awstats for general web stats, but thought of implementing something for using this contrib. for something easier than logs.

I started this, but having a little trouble...

saved as /catalog/admin/stats_referer.php

 

<?php
/*
 $Id: stats_referer.php,v .1 2005/05/09 22:50:52 hpdl Exp $
  Author: Joe McFrederick
   Released under the GNU General Public License
*/

 require('includes/application_top.php');

  function tep_get_host($url){
	 $referer = $url;
   $url = parse_url($referer);
   $host = $url['host'];
   return $host;
 }
 function tep_get_keywords($url){
   $referer = $url;
   $url = parse_url($referer);
parse_str($url['query'], $query);
   $search_keywords = '';
if (is_array($query)) {
foreach ($query as $type => $keywords) {
if (in_array($type, array('q','query','p','qkw'))) {
$search_keywords = urldecode($keywords);
break;
}
}
}
if (empty($search_keywords)) {
$keywords = "";
} else {
$keywords = $search_keywords;

}
  return $keywords;
 }

 ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
       </table></td>
<!-- body_text //-->
<td width="100%" valign="top">
    <?php
      $sql = "SELECT `referer_url` FROM `user_tracking` WHERE `referer_url` LIKE 'http%'";
      $myhost = mysql_query($sql) or die(mysql_error());
      while($row = mysql_fetch_array( $myhost )) {
        $se_array[]= tep_get_host($row['referer_url']);
      }
      $result = array_unique($se_array);

      foreach ($result as $search_engine){
      	 $mysql = '';
      	 $mysql = mysql_query("SELECT referer_url FROM user_tracking WHERE referer_url LIKE '%$search_engine%'") or die(mysql_error());
      	 while($row = mysql_fetch_array( $mysql )) {
        	 $mysql_array[]=$row['referer_url'];
        	 $mysql_count = mysql_num_rows($mysql);
        	 }
      	 echo '<table>'."\n";
      	 echo '<tr class="dataTableHeadingRow"><td class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">'.$search_engine.'</td><tr>';
      	 echo '<tr><td class="dataTableContent">No of hits '.$mysql_count.'</td></tr>';
      	 $i=0;
      	 while($i<=$mysql_count){
        	 echo '<tr><td class="dataTableContent">'.tep_get_keywords($mysql_array[$i]).'</td></tr>'."\n";
          	 $i++;
         }
           echo '</table>'."\n";

      	 }
    ?>
   </td>
 </tr>
</table>


<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by pickupman
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...