Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

VISITOR Tracking


noob

Recommended Posts

Posted

hi i was wonderin if any of u guys would tell me how to exclude my ip out of the reports

since im stil working on my site i visit it very often and it messes with the stats

 

thanks

Checkout my osc contrib here!

You can also checkout the site im working on by clicking the card button!

Posted

anyone? :(

Checkout my osc contrib here!

You can also checkout the site im working on by clicking the card button!

Posted

bump :unsure:

Checkout my osc contrib here!

You can also checkout the site im working on by clicking the card button!

Posted

don't bump.

 

Anyway try this - put this around any inserts or updates to the visitor table in the contrib:

 

 

if($b_ip != (your ip addy)

{

db query;

}

Your online success is Paramount.

Posted

thx for replying

is "your ip addy" the only thing i have to change

where exactly should i put that

these are the script changes:

2) Add the data capture lines to catalog/includes/application_top.php:

Find:

// language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language($HTTP_GET_VARS['language']);

if (!$HTTP_GET_VARS['language']) $lng->get_browser_language();

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];

}


Change to:

// language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language($HTTP_GET_VARS['language']);

if (!isset($HTTP_GET_VARS['language'])) $lng->get_browser_language();

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];

// Visitors Start
 $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
 $referer = getenv('HTTP_REFERER');
 if ($referer == '') {
 $referer = 'direct';
 }
 $uri = getenv('REQUEST_URI');
     if ( function_exists('tep_get_ip_address') ) { 
       $b_ip = tep_get_ip_address();
     } else {
       $b_ip = getenv('REMOTE_ADDR');
     }
 if ($b_lang == '') {
 $b_lang = 'robot';
 } 
 if ($customer_id) {
   $log_id = $customer_id;
 }else{
   $log_id = 0;
 }
 $b_count = '1';
 $ip_count = tep_db_query("select counter FROM " . TABLE_VISITORS . " where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");
 if (!tep_db_num_rows($ip_count)) {
 tep_db_query("insert into " . TABLE_VISITORS . " (date,customers_id,counter,browser_ip,browser_language,language,referer,uri) values (now(),'".$log_id."','".$b_count."','".$b_ip."','".$b_lang."','".$language."','".$referer."','".$uri."')");
 } else {
 $ip_values = tep_db_fetch_array($ip_count);
 $b_count = ($ip_values['counter'] + 1);
 tep_db_query("update " . TABLE_VISITORS . " set counter = '" . $b_count . "', date = now() where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");
 }

// Visitors End

}


2b) Add the following to catalog/login.php just before "// restore cart contents"


//Changes for visitor stats. Add the customer id if known
         $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
         $b_ip = getenv('REMOTE_ADDR');
         $visitor_query_string = "update visitors set customers_id = '" . $customer_id . "' where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1";
//print('<br>' . $visitor_query_string . '<br>');
         tep_db_query($visitor_query_string);
//end changes for visitor stats

2c) Add the following to catalog/create_account.php just before "if (SESSION_RECREATE == 'True') {"


//Changes for visitor stats. Add the customer id if known
     $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
     $b_ip = getenv('REMOTE_ADDR');
     $visitor_query_string = "update visitors set customers_id = '" . (int)$customer_id . "' where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1";
//print('<br>' . $visitor_query_string . '<br>');
     tep_db_query($visitor_query_string);
//end changes for visitor stats

 

i really apreciate your help :)

Checkout my osc contrib here!

You can also checkout the site im working on by clicking the card button!

Posted

this is what it says when i visit it:

 

Parse error: parse error in /home/dollward/public_html/catalog/includes/application_top.php on line 301

 

Warning: main(DIR_WS_LANGUAGES/FILENAME_DEFAULT): failed to open stream: No such file or directory in /home/dollward/public_html/catalog/index.php on line 33

 

Fatal error: main(): Failed opening required 'DIR_WS_LANGUAGES/FILENAME_DEFAULT' (include_path='.:/usr/local/lib/php') in /home/dollward/public_html/catalog/index.php on line 33

 

this is what the files look lie as of now:

the application_top.php:

// Visitors Start
 $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
 $referer = getenv('HTTP_REFERER');
 if ($referer == '') {
 $referer = 'direct';
 }
 $uri = getenv('REQUEST_URI');
     if ( function_exists('tep_get_ip_address') ) { 
       $b_ip = tep_get_ip_address();
     } else {
       $b_ip = getenv('REMOTE_ADDR');
     }
 if ($b_lang == '') {
 $b_lang = 'robot';
 } 
 if ($customer_id) {
   $log_id = $customer_id;
 }else{
   $log_id = 0;
 }
 $b_count = '1';
//addition!!!!!!!!exclude my ip addy
 if($b_ip != (144.90.8.2)
 {
 db query;
 }
 $ip_count = tep_db_query("select counter FROM " . TABLE_VISITORS . " where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");
 if (!tep_db_num_rows($ip_count)) {
 tep_db_query("insert into " . TABLE_VISITORS . " (date,customers_id,counter,browser_ip,browser_language,language,referer,uri) values (now(),'".$log_id."','".$b_count."','".$b_ip."','".$b_lang."','".$language."','".$referer."','".$uri."')");
 } else {
 $ip_values = tep_db_fetch_array($ip_count);
 $b_count = ($ip_values['counter'] + 1);
 tep_db_query("update " . TABLE_VISITORS . " set counter = '" . $b_count . "', date = now() where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");
 }

// Visitors End

}
// visitor traking addition

 

 

the login.php:

//Changes for visitor stats. Add the customer id if known
         $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
         $b_ip = getenv('REMOTE_ADDR');
         $visitor_query_string = "update visitors set customers_id = '" . $customer_id . "' where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1";
//addition!!!!!!!!exclude my ip addy
 if($b_ip != (144.90.8.2)
 {
 db query;
 }
//print('<br>' . $visitor_query_string . '<br>');
         tep_db_query($visitor_query_string);
//end changes for visitor stats

 

 

and the create_account.php:

//Changes for visitor stats. Add the customer id if known
     $b_lang = getenv('HTTP_ACCEPT_LANGUAGE');
     $b_ip = getenv('REMOTE_ADDR');
     $visitor_query_string = "update visitors set customers_id = '" . (int)$customer_id . "' where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1";
//addition!!!!!!!!exclude my ip addy
 if($b_ip != (144.90.8.2)
 {
 db query;
 }
//print('<br>' . $visitor_query_string . '<br>');
     tep_db_query($visitor_query_string);
//end changes for visitor stats

 

thx for tryin to help

Checkout my osc contrib here!

You can also checkout the site im working on by clicking the card button!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...