libraries/ManiaLib/Application/Tracking/GoogleAnalytics.php
function loadCookie()
    {
        $domainHash = $this->getDomainHash();
        $cookieRandom = rand(1000000000, 2147483647); //number under 2147483647

        $cookieUtma = '__utma' . $this->cookieNameSuffix;
        $cookieUtmb = '__utmb' . $this->cookieNameSuffix;
        $cookieUtmc = '__utmc' . $this->cookieNameSuffix;
        $cookieUtmz = '__utmz' . $this->cookieNameSuffix;

        $utma = Arrays::get($_COOKIE, $cookieUtma, '');
        $utma = $utma ? explode('.', $utma) : array();

        $utmb = Arrays::get($_COOKIE, $cookieUtmb, '');
        $utmb = $utmb ? explode('.', $utmb) : array();

        $utmc = Arrays::get($_COOKIE, $cookieUtmc, '');
        $utmc = $utmc ? explode('.', $utmc) : array();

        $utmz = array();

        $utma[0] = $domainHash; // Domain hash
        $utma[1] = Arrays::get($utma, 1, $cookieRandom); // Random unique ID
        $utma[2] = Arrays::get($utma, 2, time()); // Time of initial visit
        $utma[3] = Arrays::get($utma, 3, time()); // Begining of previous session
        $utma[4] = Arrays::get($utma, 4, time()); // Begining of current session
        $utma[5] = Arrays::get($utma, 5, 0); // Session counter

        if (!$utmb || !$utmc) {
            // New session has started
            $utma[5]++;
            $utma[3] = $utma[4];
            $utma[4] = time();
        }

        $utmb[0] = $domainHash;

        $utmc[0] = $domainHash;

        $utmz[0] = $domainHash; // Domain hash
        $utmz[1] = time(); // Timestamp
        $utmz[2] = $utma[5]; // Session number
        $utmz[3] = 1; // Campaign number
        $utmz[4] = // Campaign information
            'utmcsr=(direct)|' .//utm_source
            'utmccn=(direct)|' .//utm_campaign
            'utmcmd=(none)'; //utm_medium'

        $__utma = implode('.', $utma);
        $__utmb = implode('.', $utmb);
        $__utmc = implode('.', $utmc);
        $__utmz = implode('.', $utmz);

        setcookie($cookieUtma, $__utma, strtotime('+2 years'));
        setcookie($cookieUtmb, $__utmb, strtotime('+30 minutes'));
        setcookie($cookieUtmc, $__utmb, 0);
        setcookie($cookieUtmz, $__utmz, strtotime('+6 months'));

        $this->__utma = $__utma . ';';
        $this->__utmb = $__utmb . ';';
        $this->__utmc = $__utmc . ';';
        $this->__utmz = $__utmz . ';';
    }
function loadCookie()
    {
        $domainHash = $this->getDomainHash();
        $cookieRandom = rand(1000000000, 2147483647); //number under 2147483647

        $cookieUtma = '__utma' . $this->cookieNameSuffix;
        $cookieUtmb = '__utmb' . $this->cookieNameSuffix;
        $cookieUtmc = '__utmc' . $this->cookieNameSuffix;
        $cookieUtmz = '__utmz' . $this->cookieNameSuffix;

        $utma = Arrays::get($_COOKIE, $cookieUtma, '');
        $utma = $utma ? explode('.', $utma) : array();

        $utmb = Arrays::get($_COOKIE, $cookieUtmb, '');
        $utmb = $utmb ? explode('.', $utmb) : array();

        $utmc = Arrays::get($_COOKIE, $cookieUtmc, '');
        $utmc = $utmc ? explode('.', $utmc) : array();

        $utmz = array();

        $utma[0] = $domainHash; // Domain hash
        $utma[1] = Arrays::get($utma, 1, $cookieRandom); // Random unique ID
        $utma[2] = Arrays::get($utma, 2, time()); // Time of initial visit
        $utma[3] = Arrays::get($utma, 3, time()); // Begining of previous session
        $utma[4] = Arrays::get($utma, 4, time()); // Begining of current session
        $utma[5] = Arrays::get($utma, 5, 0); // Session counter

        if (!$utmb || !$utmc) {
            // New session has started
            $utma[5]++;
            $utma[3] = $utma[4];
            $utma[4] = time();
        }

        $utmb[0] = $domainHash;

        $utmc[0] = $domainHash;

        $utmz[0] = $domainHash; // Domain hash
        $utmz[1] = time(); // Timestamp
        $utmz[2] = $utma[5]; // Session number
        $utmz[3] = 1; // Campaign number
        $utmz[4] = // Campaign information
            'utmcsr=(direct)|' .//utm_source
            'utmccn=(direct)|' .//utm_campaign
            'utmcmd=(none)'; //utm_medium'

        $__utma = implode('.', $utma);
        $__utmb = implode('.', $utmb);
        $__utmc = implode('.', $utmc);
        $__utmz = implode('.', $utmz);

        setcookie($cookieUtma, $__utma, strtotime('+2 years'));
        setcookie($cookieUtmb, $__utmb, strtotime('+30 minutes'));
        setcookie($cookieUtmc, $__utmb, 0);
        setcookie($cookieUtmz, $__utmz, strtotime('+6 months'));

        $this->__utma = $__utma . ';';
        $this->__utmb = $__utmb . ';';
        $this->__utmc = $__utmc . ';';
        $this->__utmz = $__utmz . ';';
    }
Loads cookie information
@see http://services.google.com/analytics/breeze/en/ga_cookies/index.html