Ejemplo n.º 1
0
 /**
  * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder
  */
 protected function buildParameters()
 {
     $p = parent::buildParameters();
     $p->utmp = $this->page->getPath();
     $p->utmdt = $this->page->getTitle();
     if ($this->page->getCharset() !== null) {
         $p->utmcs = $this->page->getCharset();
     }
     if ($this->page->getReferrer() !== null) {
         $p->utmr = $this->page->getReferrer();
     }
     if ($this->page->getLoadTime() !== null) {
         // Sample sitespeed measurements
         if ($p->utmn % 100 < $this->config->getSitespeedSampleRate()) {
             $x10 = new X10();
             $x10->clearKey(self::X10_SITESPEED_PROJECT_ID);
             $x10->clearValue(self::X10_SITESPEED_PROJECT_ID);
             // Taken from ga.js code
             $key = max(min(floor($this->page->getLoadTime() / 100), 5000), 0) * 100;
             $x10->setKey(self::X10_SITESPEED_PROJECT_ID, X10::OBJECT_KEY_NUM, $key);
             $x10->setValue(self::X10_SITESPEED_PROJECT_ID, X10::VALUE_VALUE_NUM, $this->page->getLoadTime());
             $p->utme .= $x10->renderUrlString();
         }
     }
     return $p;
 }
Ejemplo n.º 2
0
 /**
  * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder
  */
 protected function buildParameters()
 {
     $p = parent::buildParameters();
     $p->utmp = $this->page->getPath();
     $p->utmdt = $this->page->getTitle();
     if ($this->page->getCharset() !== null) {
         $p->utmcs = $this->page->getCharset();
     }
     if ($this->page->getReferrer() !== null) {
         $p->utmr = $this->page->getReferrer();
     }
     return $p;
 }