Zen Cart Logo
Forums / All Other Contributions/Addons / User tracking mod

User tracking mod

Views: 183,739

Results 381 to 400 of 861
11 Jun 2009, 2:08 AM
#381
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

User tracking mod

What does not work with 1.3.8? Do not collect data? Try this:

<?php
/**
 * user_tracking functions
 *
 * @package user_tracking
 * @copyright Copyright 2004-2009 Andrew Berezin eCommerce-Service.com
 * @copyright Portions Copyright 2005 Petter Norrman
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: user_tracking.php 1.4 13.02.2008 4:18 Andrew Berezin $
 */

  function net_match($network, $ip) {
    if (($ip_long = ip2long($ip)) === false) return false;
    // determines if a network in the form of 192.168.17.1/16 or
    // 127.0.0.1/255.255.255.255 or 10.0.0.1 matches a given ip
    $ip_arr = explode('/', $network);
    if (($network_long = ip2long($ip_arr[0])) === false) return false;
    if (!isset($ip_arr[1])) $ip_arr[1] = '255.255.255.255';
    $x = ip2long($ip_arr[1]);
    $mask = long2ip($x) == $ip_arr[1] ? $x : 0xffffffff << (32 - $ip_arr[1]);
    return ($ip_long & $mask) == ($network_long & $mask);
  }

  function zen_update_user_tracking() {
    global $db;

    $wo_ip_address = (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'Unknown');
    foreach (explode(",", CONFIG_USER_TRACKING_EXCLUDED) as $skip_ip) {
      if ($skip_this_ip = net_match(trim($skip_ip), $wo_ip_address)) {
        break;
      }
    }
    if ($skip_this_ip == true) return;

    if (isset($_SESSION['customer_id']) && (int)$_SESSION['customer_id'] > 0) {
      $wo_customer_id = (int)$_SESSION['customer_id'];
      $customer = $db->Execute("SELECT customers_firstname, customers_lastname 
                                FROM " . TABLE_CUSTOMERS . " 
                                WHERE customers_id = '" . (int)$_SESSION['customer_id'] . "'");
      $wo_full_name = $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'];
    } else {
      $wo_customer_id = 0;
      $wo_full_name = '¥' . 'Guest';
    }

    if (!isset($spider_flag)) {
      $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
      $spider_flag = false;
      if (zen_not_null($user_agent)) {
        $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');
        for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
          if (zen_not_null($spiders[$i])) {
            if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
              $spider_flag = true;
              break;
            }
          }
        }
      }
    }
    if ($spider_flag) {
      $wo_full_name = 'BOT ' . trim($spiders[$i]);
    }

    $wo_session_id = zen_session_id();

    if ($wo_session_id == '') {
      $wo_session_id = gethostbyaddr($wo_ip_address);
    }

    $wo_last_page_url = $_SERVER['REQUEST_URI'];

    $referer_url = (isset($_SERVER['HTTP_REFERER'])) ? $wo_last_page_url : $_SERVER['HTTP_REFERER'];

    global $breadcrumb;
    $page_desc = $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR);
    $page_desc = strip_tags($page_desc);
    $page_desc = str_replace(BREAD_CRUMBS_SEPARATOR . "\n" . 'NAVBAR_TITLE', '', $page_desc); // Fix for TPP
    $page_desc = str_replace(array("\n", ' ', '  '), array(' '), $page_desc);
    $page_desc = trim($page_desc);

    $current_time = time();

//    $db->Execute("ALTER TABLE " . TABLE_USER_TRACKING . " CHANGE page_desc page_desc VARCHAR(254)");

    $sql = "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 (:customer_id:, :wo_full_name:, :wo_session_id:, :wo_ip_address:, :current_time:, :current_time:, :wo_last_page_url:, :referer_url:, :page_desc:)";
    $sql = $db->bindVars($sql, ':customer_id:', $wo_customer_id, 'integer');
    $sql = $db->bindVars($sql, ':wo_full_name:', $wo_full_name, 'string');
    $sql = $db->bindVars($sql, ':wo_session_id:', $wo_session_id, 'string');
    $sql = $db->bindVars($sql, ':wo_ip_address:', $wo_ip_address, 'string');
    $sql = $db->bindVars($sql, ':current_time:', $current_time, 'integer');
    $sql = $db->bindVars($sql, ':wo_last_page_url:', $wo_last_page_url, 'string');
    $sql = $db->bindVars($sql, ':referer_url:', $referer_url, 'string');
    $sql = $db->bindVars($sql, ':page_desc:', $page_desc, 'string');
    $db->Execute($sql);

  }
11 Jun 2009, 2:34 AM
#382
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: User tracking mod

Replace
$wo_full_name = '¥' . 'Guest';
by
$wo_full_name = 'Guest';

6 Jul 2009, 9:35 PM
#383
abko avatar

abko

New Zenner

Join Date:
Mar 2009
Posts:
17
Plugin Contributions:
0

Re: User tracking mod

Hi everyone,
I'm running the latest zen cart with the updated security patch and I recently started having a problem with user tracking resulting in a blank page. I loaded the debug php file and the results show: PHP Fatal error: Cannot redeclare geoip_country_code_by_name() in /<site path/<admin>/includes/geoip.inc on line 159. I tried the updated PHP file posted by a_berezin, but this did not resolve my issue. I cannot correlate any changes that I've made to this problem. I re-transferred the user tracking files to my site and overwrote the files already present, but this did not help..... Any idea's what's going on?
Thanks for your help!

11 Jul 2009, 3:50 AM
#384
abko avatar

abko

New Zenner

Join Date:
Mar 2009
Posts:
17
Plugin Contributions:
0

Re: User tracking mod

abko:

Hi everyone,
I'm running the latest zen cart with the updated security patch and I recently started having a problem with user tracking resulting in a blank page. I loaded the debug php file and the results show: PHP Fatal error: Cannot redeclare geoip_country_code_by_name() in /<site path/<admin>/includes/geoip.inc on line 159. I tried the updated PHP file posted by a_berezin, but this did not resolve my issue. I cannot correlate any changes that I've made to this problem. I re-transferred the user tracking files to my site and overwrote the files already present, but this did not help..... Any idea's what's going on?
Thanks for your help!

Found it! It appears that two functions in the geoip.inc file are now included with PHP, so they were being declared twice. I had to comment out these two functions: geoip_country_code_by_name geoip_country_name_by_name
Hope this helps someone else.

1 Aug 2009, 11:31 AM
#385
martin_smith avatar

martin_smith

New Zenner

Join Date:
Mar 2009
Posts:
51
Plugin Contributions:
0

Re: User tracking mod

Have a site using v 1.38......installed user tracking mod and it does not work. Do not get all the configs to set up and it only tracks the admin logins not any users.

Anyone have the 1.38 version ?

Have pm'd boomba but no answer.

Would like to use this mod but if no support, I'll use super tracker.

Thanks,
Martin

3 Aug 2009, 1:58 AM
#386
martin_smith avatar

martin_smith

New Zenner

Join Date:
Mar 2009
Posts:
51
Plugin Contributions:
0

Re: User tracking mod

Boy I can see why this mod won't work in v 1.38.

This thread is dead.

Thanks for all the help.

18 Aug 2009, 7:40 PM
#387
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: User tracking mod

I've just installed this mod on 1.38a with various other mods already installed.

No problems and all is running smoothly.

18 Aug 2009, 10:42 PM
#388
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: User tracking mod

I have it installed on several 1.3.8a without any problems. It is helpful if you can elaborate on what you did to install, other mods you have, the version of user tracking you are using. Usually it is an installation/configuration error. And sometimes it can take more than 1 day to get a response!:P It sounds like you either forgot to add <?php if (ZEN_CONFIG_USER_TRACKING == 'true') { zen_update_user_tracking(); } ?> to the bottom of includes/template/YOUR_TEMPLATE/common/tpl_footer.php or you added it to the wrong file ie includes/templates/template_default/common/tpl_footer.php or something like that.

21 Aug 2009, 4:06 PM
#389
gabyone avatar

gabyone

New Zenner

Join Date:
Mar 2005
Posts:
4
Plugin Contributions:
0

Re: User tracking mod

Hello,
Can anybody tell me what is this link that I am keep founding on my user tracking results?
"Host: host69-173-dynamic.22-79-r.retail.telecomitalia.it " ,
" Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
"Host: 0x57373c9f.nfnqu1.dynamic.dsl.tele.dk " ,
"Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
"Host: 218.186.10.10.cache.maxonline.com.sg " ,
" Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
and every day I find a lot of links like this. The "Host" is from around the world ( Japan, Korea, Singapore, Denmark, United States etc.).
I followed the link " http://217.218.225.2:2082/index.html?" and is a Cpanel login page.
Is someone using My SITE? Am I hacked?

21 Aug 2009, 5:00 PM
#390
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: User tracking mod

gabyone:

Hello,
Can anybody tell me what is this link that I am keep founding on my user tracking results?
"Host: host69-173-dynamic.22-79-r.retail.telecomitalia.it " ,
" Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
"Host: 0x57373c9f.nfnqu1.dynamic.dsl.tele.dk " ,
"Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
"Host: 218.186.10.10.cache.maxonline.com.sg " ,
" Originating URL: /index.php?main_page=http://217.218.225.2:2082/index.html? "
and every day I find a lot of links like this. The "Host" is from around the world ( Japan, Korea, Singapore, Denmark, United States etc.).
I followed the link " http://217.218.225.2:2082/index.html?" and is a Cpanel login page.
Is someone using My SITE? Am I hacked?

Is this your IP address? 217.218.225.2? It looks like something is broken, has it been working fine and suddenly started this behavior? Are they able to get around your site or are they leaving after the one page visit?

9 Sep 2009, 5:20 AM
#392
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Re: User tracking mod

Where will I find a complete set of current installation instructions along with all suggested settings and gotchas?

Thanks.

20 Sep 2009, 1:49 PM
#393
javier avatar

javier

New Zenner

Join Date:
Jun 2007
Posts:
79
Plugin Contributions:
0

Re: User tracking mod

Hi,

Using ZC 1.3.7 and have user tracking mod installed. However, should it show the country of origin of visitors? - I have never had this working if it is supposed to.

20 Sep 2009, 7:22 PM
#394
barry_g avatar

barry_g

New Zenner

Join Date:
Mar 2009
Posts:
47
Plugin Contributions:
0

Re: User tracking mod

Hello Javier, I had some problems and got them worked out..perhaps I can help.

May I ask if you see user tracking in your admin panel? If yes to you get an error?

Ah I see....its working but the flags and country of origin is missing?

20 Sep 2009, 8:45 PM
#395
beasleybub avatar

beasleybub

Zen Follower

Join Date:
May 2006
Location:
Virginia U.S
Posts:
176
Plugin Contributions:
1

Re: User tracking mod

I'd like to change gears for a moment please.

how to you change how many hours to purge?

Instead of purging records older than 72 hours I would like to please change records older than 24 hours.

I tried changing all instances of 72 in the files but this did not work.

Do I also need to modify the database somehow?

Thanks

21 Sep 2009, 7:45 AM
#396
javier avatar

javier

New Zenner

Join Date:
Jun 2007
Posts:
79
Plugin Contributions:
0

Re: User tracking mod

barry g:

Hello Javier, I had some problems and got them worked out..perhaps I can help.

May I ask if you see user tracking in your admin panel? If yes to you get an error?

Ah I see....its working but the flags and country of origin is missing?

Yes, it is working fine except for the flag of the country of origin is always just the US flag.

22 Sep 2009, 3:10 AM
#397
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: User tracking mod

Is it possible to have this mod altered to create a new sidebox to display "Customer Who Viewed This Item Also Viewed" similar to this: http://www.overstock.com/Electronics/Toshiba-32AV502R-31.5-inch-720p-LCD-TV-with-CineSpeed-Refurbished/3923272/product.html?keywords=11964502&searchtype=HP_Header&pid=1260291&aid=10654383

I think it would a great a addition to Zen Cart.

22 Sep 2009, 3:38 PM
#398
javier avatar

javier

New Zenner

Join Date:
Jun 2007
Posts:
79
Plugin Contributions:
0

Re: User tracking mod

Why a new sidebox?? This is an admin side mod that already shows what pages a visitor looked at. If you want a detailed analysis of visits, take a look at Google Analytics. Or you can even see from the admin panel, under Reports, which items are viewed most or least and how many of each have been purchased.

23 Sep 2009, 3:25 PM
#399
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: User tracking mod

I know about the admin side mod. The sidebox or centerbox I am talking about is used to automatically upsell products for the customers. Overstock have been utilizing this for years. Ebay has a similar version that they just start using, by recommending products to the user based on what items they viewed. It is hard to manually upsell products when you have thousands of products.

By automating this process you can save a lot of time. In my case I sell car parts so if someone is looking for a part for their car based on their car make and model, if you display other products on that is related to their car they might be interested in buying it.

This was just a suggestion for the general Zen Cart user. We will be developing a smart version of this mod for my website in the next few month that will use cookies to track customers behaviour and upsell products that is 100% related to their cars based on database, cache and cookies. It would be very similar to eBay system.

28 Sep 2009, 6:59 AM
#400
beasleybub avatar

beasleybub

Zen Follower

Join Date:
May 2006
Location:
Virginia U.S
Posts:
176
Plugin Contributions:
1

Re: User tracking mod

I hate to bump this but I have not gotten any response and think my question got lost in the mix.

I'd like to change gears for a moment please.

how to you change how many hours to purge?

Instead of purging records older than 72 hours I would like to please change records older than 24 hours.

I tried changing all instances of 72 in the files but this did not work.

Do I also need to modify the database somehow?

Thanks