Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

User Tracking with Admin 1.31 Released


Druide

Recommended Posts

Originating URL doesn't work at my site. The readme says: Look for: "tep_session_start();"

But there are three of these phrases (i've tried all three, but none seems to work).

 

This is the code of application_top.php:

// start the session

 $session_started = false;

 if (SESSION_FORCE_COOKIE_USE == 'True') {

   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);



   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {

     tep_session_start();



     $session_started = true;

   }

 } elseif (SESSION_BLOCK_SPIDERS == 'True') {

   $user_agent = strtolower(getenv('HTTP_USER_AGENT'));

   $spider_flag = false;



   if (tep_not_null($user_agent)) {

     $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');



     for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {

       if (tep_not_null($spiders[$i])) {

         if (is_integer(strpos($user_agent, trim($spiders[$i])))) {

           $spider_flag = true;

           break;

         }

       }

     }

   }



   if ($spider_flag == false) {

     tep_session_start();



     $session_started = true;



   }

 } else {

   tep_session_start();



   $session_started = true;

 }

 

Anybody?

Link to comment
Share on other sites

  • Replies 570
  • Created
  • Last Reply

Top Posters In This Topic

Try this.

 

BACKUP FIRST!

 

Open

/catalog/includes/application_top.php

 

Search for 'cart'

 

after several finds of the instance 'cart' you will come across the line

//create the shopping cart & fix the cart if necessary

 

Immediately above this line insert

 

//user tracking modifications

if (!$referer_url) {

$referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];

if ($referer_url) {

tep_session_register('referer_url');

}

}

 

Ensure you have no spaces etc...the usual.

 

Enjoy! :D

Link to comment
Share on other sites

Never did see a 'how to' on the following post.

Shame as it could provide a serious performace hike for this contribution.

 

bdaug001, care to share? It would be appreciated.

 

I recently had a problem with the user tracking admin display loading very slowly (in excess of 60secs) and saw from browsing the forum that a couple other people had the same problem. Forgive me for reposting if a solution to this has already been found.

 

Basically, the bottleneck in the script is the line in the admin/user_tracking.php file that contains 'gethostbyaddr'. Basically what this is doing is calling the system to do a hostname lookup on every single ip address on the page, and it does this for every page hit (for example, if you click view session, it again tries a reverse lookup on every ip addr on the page). If any of these lookups fails, the script will hang there for a few secs before moving on.

 

The quick solution to this is to comment out that line (change 'echo gethostbyaddr' to '//echo gethostbyaddr').

 

I have modified my install so that the store does a reverse dns the first time the user visits the store, stores this info in the database, and then sets a session variable so that this lookup doesnt occur again. This has speeded up the script operation for me tremendously, and the page loads in about 3 secs with 700-1000 users' information.

 

Hopefully other will find this information useful, and again good job to the author of User Tracking for an awesome contribution. I think it is probably the coolest contribution I have seen, and is always my first stop when i log into my admin :) :)

Link to comment
Share on other sites

Hi Linda,

 

Thanks for responding. First I'd like to say how much I appreciate your great contributions and your guidance in these forums. I checked footer.php just to be sure and the code is there. I'm completely stumped! Has anyone had this problem before? It's very strange.

 

Thanks,

 

Joseph

Link to comment
Share on other sites

Hi,

 

Found the problem: the code to be put in footer.php was at the very end of the file--which is after the banner section. I put it above that and it's now working. Thanks Linda for suggesting I take a look there. Didn't catch it the last 20 or so times I looked at that file but this time it worked!

 

Thanks again,

 

Joseph

Link to comment
Share on other sites

Hi,

 

Found the problem: the code to be put in footer.php was at the very end of the file--which is after the banner section. I put it above that and it's now working. Thanks Linda for suggesting I take a look there. Didn't catch it the last 20 or so times I looked at that file but this time it worked!

 

Thanks again,

 

Joseph

 

Sneaky thing ... the placement of code, eh?

 

Glad you are working now. :D

Link to comment
Share on other sites

I might be eating my words re user tracking working finally....

 

I would welcome any pointers with the following.

 

In admin user tracking all looks fine, flags showing different IP's etc showing.

But one thing I've noticed is that multiple entries in the list seems to grow in page views, repetitive page views.

 

I cannot delete the entry from the page, what I have to do is enter the IP address into admin user tcking config > exclude this IP address then select purge all records from IP addres at the top of the page.

 

But what this does is reveal another entry, total pages may drop 1 or more pages. These entries can either be customers or bots but there is no correlation so far.

 

To actually delete what appears to be a stacked entry i.e. instead of 15 seperate entries they are stacked. So deleting what appears to be a single entry using the above method peels back subsequent entries with a lesser page count and different IP details etc underneath.

 

Just had to do it again over 15 times to finally delete an entry.

 

So whilst this this contribution is superb I obviously have not configured something correctly but I am damned if I know what it is.

 

Using tep snapshot 20030518 with

SEC v1_0b

User tracking with admin 1.34

Review approval

Purchase without account

Scrolling links

Cross sell

Links manager

Admin account with acces levels.

 

All ideas and pointers would be very welcome as this is a live site, had not noticed the stacking of user tracking entries during testing....

 

Help please!

Link to comment
Share on other sites

I have this in my SECv2.2 and have been able to delete the given user session without too much trouble.

 

In case I am missing something, I will try clearing out the whole table with the delete and make sure the table is in fact empty after wards.

 

I have user tracking off on the admin, on for the catalog and I have no exclusions on IP addresses to track.

Link to comment
Share on other sites

I deleted everyone ... and had one session left. So, I went through and cleaned via phpMyAdmin. Then started over making new entries ... when I deleted it, it seemed to clean them all.

 

I will play with this on and off and see if I can get things stuck in the User Tracking through out the day.

Link to comment
Share on other sites

Linda,

 

Thanks for the input.

Further information.

 

I did exactly the same as yourself, the only entries I was able to delete were NOT stacked as previously described.

 

Lets refer to the following method of deleting sessions as 'method 2'

enter the IP into User Track config and then invoking 'Delete all info from IP-Address xxx.xxx.xxx.xxx purge all'

 

 

Googlebot has just shown up on User Tracking as a Guest with '2' click counts but immediately states session expired (Don't know if this is relevent)

I then opened up a session onto my site from another computer.

 

I could delete the session I created from another computer browser.

I could not delete the bot session.

 

Googlebot now has 5 click counts crawler10.googlebot.com 64.68.82.28

Yet the session is still expired?

 

All following deletions were via method 2 as [delete session] does not delete these sessions.

 

deleting this session reveals another IP address with 4 click counts. crawler14.googlebot.com 64.68.82.168

 

delete this session reveals another IP 3 click counts crawler11.googlebot.com 64.68.82.38

 

delete this session reveals another IP 2 click counts

crawler10.googlebot.com 64.68.82.7

 

delete this session reveals another IP 1 click counts

crawler10.googlebot.com 64.68.82.18

 

delete this session Aha empty....

 

All the above were marked session expired even though last activity was within a minute.

 

 

 

Theorising.

The stacked session entries usually have a bot entry. Not just googlebot as I am being nailed by bots hourly.

 

Once a bot has appeared traffic drops off according to User Tracking and yet perusal of who's online shows other users.

 

Maybe a 'session expired' bot session entry in User Tracking is somehow resulting in other sessions being either stacked underneath or stopped from being listed.

 

However it still does not discount the fact I cannot delete this bot session using method 2

 

Additionally I had already cleared out all entries, no entries in the table checked via PHPadmin.

 

I have user tracking off on the admin, on for the catalog and I have no exclusions on IP addresses to track.

Same here.

 

 

 

Another thought! Would regularly changing the IP addresses to track cause an issue? as required for method 2 deletion

 

 

Ah crawler10 is back. 5 click counts

Can user tracking differentiate between the last octet of an IP address or does it use the first 3 octets only? This would explain it stacking sessions as a single session and subsequent refusal to being deleted.

 

using a refresh crawler10 just jumped to crawler 14 and from 5 to 7 click counts and the last octet of the IP changed to 168 from 28

 

Just used method 2 to delete this session and have

crawler10 64.68.82.28 6 click counts

and so on and so forth endlessly.

 

 

Hope all my ramblings help.

 

Thanks

Link to comment
Share on other sites

Let me play and I will look at google too as on my demo site google is peeking in from time to time.

 

Might be a bit, but I will try to resolve this if the Author of User Tracking doesn't happen to jump in with a solution first.

Link to comment
Share on other sites

Linda,

 

The only sessions that stack and cannot be deleted are bot sessions.

 

I mistook several layers of bots for customers sessions

 

NOTE!

All bot sessions / stacks of bots have no session ID and session expired shopping carts.

 

From PHPAdmin modify the problem session table entry and insert a session id.

Here you can see I just added loads of the letter 'c'

 

customer_id click_id full_name session_id ip_address time_entry time_last_click last_page_url page_desc

0 NULL Guest ccccccccccccccccccccccccc 212.222.XXX.X 1063117092 1063117092 White Grease (Heat / Water Resistant Viscostatic Grease)

 

refresh the admin page so the session id shows you can then delete the entry OK (in this instance it was a single bot entry so the entire session was deleted having no more bots underneath)

 

 

A couple of other things!

This morning when I deleted a stacked session entry of bots the last session entry had 1 page view. I used method 2 to delete the session entry (not having discovered the above information yet, it deleted all sessions including legitimate customer sessions. Ouch.

 

Also the page URL tracking whilst listing the correct page does not contain the correct URL to that page!! Should it?

 

Hope some of this helps.

Link to comment
Share on other sites

I am not having any trouble deleting individual sessions whether a bot or not.

 

I have some bot sessions with just a couple entries and others with go some 60-200 links.

 

The bots do not show the session ID which I set under Sessions to Prevent Spiders True

 

I am not sure why you'd have such a hard time deleting sessions.

 

The delete on the individual session should remove that one cleanly.

 

The delete all sessions is based on after 72 hours old, example.

 

Now displaying the latest 100 sessions of this 24 hour period. You can also purge all records past the last 72 hours of data

 

The "purge all records" is a link to delete older sessions.

 

The purge all records from IP address is more or less for convenience to remove your own IP address from the list.

 

Meanwhile, I am not sure where your delete issues are steming from on this. You may need to contact the author or User Tracking and see if there is something specific that you need to do. I just cannot recreate your problems on this one.

Link to comment
Share on other sites

Beg your pardon folks if I seem to simpleminded but I tried quite a few positions of that referer-url code in application_top.php as suggested in different locations in this thread but my user tracker (wich works fantastic beside that) won't show me the referer url.

 

Please, what can be the reason for that.

 

I'm runnin ms2 with user tracker with Admin 1.35

 

Thanks for your patience

Manfred

Link to comment
Share on other sites

I downloaded v1.35. Instructions tell to modify filenames.php and database_tables.php, but I don`t have these files.

What should I do?

 

I use Japanese osCommerce and I downloaded the latest version that was published in July.

 

Thanks,

Janika

Link to comment
Share on other sites

OK, I got it!

 

In Japanese version the tables and files are all defined in application_top.

 

I installed the user tracker and it seems to work OK. :D :D

 

Thanks a lot for this great work!

 

Janika

Link to comment
Share on other sites

I do not know in which log file you can see the info but this is the way I did, adding a db field to record the "referer_url" when the user enters the page (if there's a reason why it has not been done this way, please post).

I'm using User Tracking with Admin 1.34

 

please BACKUP and:

 

add a db field to user_tracking table :

referer_url varchar(128) NOT NULL default ''

in catalog/includes/functions/user_tracking.php after line 57 (before $current_time = time(); ) add

$HTTP_SERVER_VARS =& $_SERVER;

$wo_referer_url = ($HTTP_SERVER_VARS['HTTP_REFERER'] == '') ?  $wo_last_page_url : $HTTP_SERVER_VARS['HTTP_REFERER'];

at bottom page change the query to:

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

then in admin/user_tracking.php the "$whos_online_query" (around line 103) change to:

tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url," .

line 113 below $user_tracking[$whos_online['session_id']]['customer_id']=$whos_online['customer_id'];

 

add:

$user_tracking[$whos_online['session_id']]['referer_url']=$whos_online['referer_url'];

 

around line 250 replace

<td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'.$referer_url.'" target="_new">'. $referer_url .'</a>'; ?> </td>

with:

<td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'. $ut['value']['referer_url'] .'" target="_new">'. $ut['value']['referer_url'] .'</a>'; ?> </td>

I'm not aware of a different way, maybe the same infos can be retrieved more easily but it seems to work so ...

... did I tell you to BACKUP first ?

Link to comment
Share on other sites

Thanks for the input alverman.

The logfile one can see this is the apache log or of whatever server you use.

 

I'll compare your stuff to my 1.35 and try to put it in tomorrow. Funny that it seems to work with others though.

 

Reckon I'll back up first :-)

(no I test it on my local test server first anyway. Won't see whether it works but whether it screws everything up :twisted: )

 

Cheers

Manfred

Link to comment
Share on other sites

  • 2 weeks later...

In the Adminarea you are able to set the URL for a "whois" site.

But it dose not effect the sourcecode becaus it is harcoded in the user_tracking.php.

 

You have to change the following in user_tracking.php

 

Find:

 

<td class="dataTableContent" valign="top"><a href="http://www.dnsstuff.com/tools/whois.ch?ip=<?php echo $ut['value']['ip_address'] ; ?>" target="_new"><?php echo $ut['value']['ip_address'] ; ?></a></td>

 

 

And replace with:

 

<td class="dataTableContent" valign="top"><?php echo '<a href="' . USER_TRACKING_WHOIS_URL . $ut['value']['ip_address'] ; ?>" target="_new"><?php echo $ut['value']['ip_address'] ; ?></a></td>

 

 

Than the Adminsettings will have effect to your settings in Admin.

 

My favorit URLtracker is:

http://www.keylantracker.com/route?go=

Thanks Matthias

Link to comment
Share on other sites

I added the Alverman fix to get the Originating Url: to function correct and it does...

 

Thank you very much Alverman, for your efforts.

 

The only question in my mind is what happens if the HTTP_REFERER variable is greater than 128 chars - is this possible? I thought the max length of a url was 255 chars.

 

The only thing I've outstanding on this contribution is that I need to write a daily/weekly/monthly report on Usage Stats, where they came from and what they did.

 

 

I'll keep the community updated on the progress...

 

I feel I'm going to have some fun converting the varchar "date field" of time_entry into a proper date field...

 

Keep Smiling,

Keith

Link to comment
Share on other sites

Since I set up a new server I had no time yet to test alvermans referer-url solution. But that's gonna be the next thing I'll do.

 

At the moment I got puzzled about me system giving certain visitors multiple session-id's at the same time.

I think the following image shows what I mean. Watch the ip-adress, the time and the session-id's.

I somehow got the feeling that the server should be somewhat more economical with the session-id's.

 

Any suggestions why it is that way and if I can do something to change that behaviour.

 

tracker.gif

 

OSC 2.2ms2

register globals 1

admin is outside catalog

Debian woody with

Standard Kernel 2.4.18

apache 1.3.26

mysql 3.23

php 4.1.2

Link to comment
Share on other sites

------------------------------------------------------------

 

found the answer:

 

when using the bts-contribution

you have to edit your main_page.tpl.php and add this line to the end of the file

 

<?php

require(DIR_WS_FUNCTIONS . 'user_tracking.php');

if ( OSC_CONFIG_USER_TRACKING == 'true') { tep_update_user_tracking(); }

?>

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...