コード例 #1
0
ファイル: Request.php プロジェクト: sspaeti/ImpressPages
 /**
  * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/core/GIFRequest.as#123
  * @param \Plugin\GoogleAnalytics\ApiLib\Internals\ParameterHolder $p
  * @return \Plugin\GoogleAnalytics\ApiLib\Internals\ParameterHolder
  */
 protected function buildCookieParameters(ParameterHolder $p)
 {
     $domainHash = $this->generateDomainHash();
     $p->__utma = $domainHash . '.';
     $p->__utma .= $this->visitor->getUniqueId() . '.';
     $p->__utma .= $this->visitor->getFirstVisitTime()->format('U') . '.';
     $p->__utma .= $this->visitor->getPreviousVisitTime()->format('U') . '.';
     $p->__utma .= $this->visitor->getCurrentVisitTime()->format('U') . '.';
     $p->__utma .= $this->visitor->getVisitCount();
     $p->__utmb = $domainHash . '.';
     $p->__utmb .= $this->session->getTrackCount() . '.';
     // FIXME: What does "token" mean? I only encountered a value of 10 in my tests.
     $p->__utmb .= 10 . '.';
     $p->__utmb .= $this->session->getStartTime()->format('U');
     $p->__utmc = $domainHash;
     $cookies = array();
     $cookies[] = '__utma=' . $p->__utma . ';';
     if ($p->__utmz) {
         $cookies[] = '__utmz=' . $p->__utmz . ';';
     }
     if ($p->__utmv) {
         $cookies[] = '__utmv=' . $p->__utmv . ';';
     }
     $p->utmcc = implode('+', $cookies);
     return $p;
 }
コード例 #2
0
ファイル: Visitor.php プロジェクト: sspaeti/ImpressPages
 /**
  * Updates the "previousVisitTime", "currentVisitTime" and "visitCount"
  * fields based on the given session object.
  *
  * @param Session $session
  */
 public function addSession(Session $session)
 {
     $startTime = $session->getStartTime();
     if ($startTime != $this->currentVisitTime) {
         $this->previousVisitTime = $this->currentVisitTime;
         $this->currentVisitTime = $startTime;
         ++$this->visitCount;
     }
 }