Track Visitor’s Information in Magento
<?php
$visitorInfo = Mage::getSingleton(‘core/session’)->getVisitorData();
print_r($visitorInfo);
// Array
// (
// [] =>
// [server_addr] => 167772437
// [remote_addr] => 167772437
// [http_secure] =>
// [http_host] => 127.0.0.1
// [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
//AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10
// [http_accept_language] => en-US,en;q=0.8
// [http_accept_charset] => ISO-8859-1,utf-8;q=0.7,*;q=0.3
// [request_uri] => /magento/index.php/catalog/category/view/id/22
// [session_id] => 13qm5u80238vb15lupqcac97r5
// [http_referer] => http://127.0.0.1/magento/
// [first_visit_at] => 2011-01-17 11:42:23
// [is_new_visitor] =>
// [last_visit_at] => 2011-01-17 11:58:38
// [visitor_id] => 41
// [last_url_id] => 139
// )
// user’s ip address (visitor’s ip address)
$remoteAddr = Mage::helper(‘core/http’)->getRemoteAddr(true);
// server’s ip address (where the current script is)
$serverAddr = Mage::helper(‘core/http’)->getServerAddr(true);
?>