I need Magento's visitor_id to save some data against visitors come to my Magento store. But I found in some instances $session[visitor_data] array is empty. But I can see frontend cookie is created.

  1. Have anyone came across this situation?
  2. How do I populate visitor id, if its not available?
  3. If this is not possible what would be the best way to uniquely identify a visitor?

1 Answer 1


Look at /app/code/core/Mage/Log/Model/Visitor.php You can use the same event to get the data you want (Ref: /app/code/core/Mage/Log/etc/config.xml)

public function saveByRequest($observer)
    if ($this->_skipRequestLogging || $this->isModuleIgnored($observer)) {
        return $this;

    try {
    } catch (Exception $e) {
    return $this;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.