Magento Module: Image Cleaner

A visitor tracking system that helps to debug specific user journeys.

Details

This module was developed to track user input and flow through the checkout process. It was initially designed to debug some duplicate registration problems that could not be identified through server logs. It became a generic tool for visitor tracking.

Screenshots

Managing interaction log profiles

Configuring an interaction profile

Configuring module settings

Viewing captured log data summaries

Viewing captured log details

Technical Features

Code Sample

private function _verifyAbuseClaim()
{
    $ip         = Mage::helper('core/http')->getRemoteAddr();
    $key        = md5( strtoupper(__CLASS__) . '_' . $ip );
    $cache      = Mage::app()->getCache();
    $data       = $cache->load($key);
    $now        = time();
    $timeLimit  = Mage::getStoreConfig(self::XML_CONFIG_PATH_TIME_LIMIT);
    $maxHits    = Mage::getStoreConfig(self::XML_CONFIG_PATH_MAX_REQUESTS);

    if (empty($data)) {
        $data = array();
    } else if (is_string($data)) {
        $data = (array) @unserialize($data);
    }

    $data['count']  = isset($data['count']) ? ( (int) $data['count'] + 1 ) : 1;
    $data['last']   = isset($data['last']) ? $data['last'] : time();

    if ($data['count'] > $maxHits) {
        if ( ( $now - $data['last'] ) < $timeLimit ) {
            throw new Zend_Http_Exception('Too many requests.', 429);
        } else {
            $data['last']   = $now;
            $data['count']  = 1;
        }
    }

    $cache->save( serialize($data), $key, array(self::CACHE_TAG), ($timeLimit * 2) );
}

Static Analysis