@diosmosis opened this issue on September 21st 2014

Normal metrics (like 'nb_visits', 'nb_hits', etc.) should be defined in their own classes like Reports/Dimensions/Segments are. For example:

class Visits
{
    protected function init()
    {
        $this->id = 'nb_visits';
        $this->entityTable = 'log_visit';
    }

    public function aggregate($lhs, $rhs)
    {
        return $lhs + $rhs;
    }

    public function aggregateSql()
    {
        return "COUNT(*)";
    }
}

Care should be taken to consider non-relational databases. If possible, changes should be futureproof.

Powered by GitHub Issue Mirror