0

The log_url_info table should ideally log every url visited. It seems to work by logging the "request_uri" in the session data for the user. "request_uri" in the session data is not updated, even after adding products to cart. The result is a new duplicate entry into "log_url_info" with every page load for that session.

Has anyone figured out how to fix the url logger so that it logs every url a visitor loads, not just the first?

Each of these url's should be different: same url

UPDATE: I tried this in an ultra vanilla install of 1.9.3.0, with the only change being a switch from "Visitors only" to "Yes" in System -> Configuration -> System -> Log -> Enable Log same issue! Which confirms it's either a misconfiguration or a Magento bug.

0

URL logging is a little half baked and is left over from the days before Analytics became what it is. To make the logger save every URL you'll need to modify Mage/Log/Model/Visitor.php (preferably as a local override) and insert $this->setRequestUri($this->_httpHelper->getRequestUri(true)); after $this->setLastVisitAt(now()); in saveByRequest.

Once all is set and done it should look like this on 1.9.3.0

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

    try {
        $this->setLastVisitAt(now());
        $this->setRequestUri($this->_httpHelper->getRequestUri(true));
        $this->save();
        $this->_session->setVisitorData($this->getData());
    } catch (Exception $e) {
        Mage::logException($e);
    }
    return $this;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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