/** * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/v4/Tracker.as#1503 * * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildParameters() { $p = parent::buildParameters(); $x10 = new X10(); $x10->clearKey(self::X10_EVENT_PROJECT_ID); $x10->clearValue(self::X10_EVENT_PROJECT_ID); // Object / Category $x10->setKey(self::X10_EVENT_PROJECT_ID, X10::OBJECT_KEY_NUM, $this->event->getCategory()); // Event Type / Action $x10->setKey(self::X10_EVENT_PROJECT_ID, X10::TYPE_KEY_NUM, $this->event->getAction()); if ($this->event->getLabel() !== null) { // Event Description / Label $x10->setKey(self::X10_EVENT_PROJECT_ID, X10::LABEL_KEY_NUM, $this->event->getLabel()); } if ($this->event->getValue() !== null) { $x10->setValue(self::X10_EVENT_PROJECT_ID, X10::VALUE_VALUE_NUM, $this->event->getValue()); } $p->utme .= $x10->renderUrlString(); if ($this->event->getNoninteraction()) { $p->utmni = 1; } if (isset($this->page)) { $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; }
/** * @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; }
/** * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/v4/Tracker.as#1503 * * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildParameters() { $p = parent::buildParameters(); $x10 = new X10(); $x10->clearKey(self::X10_EVENT_PROJECT_ID); $x10->clearValue(self::X10_EVENT_PROJECT_ID); // Object / Category $x10->setKey(self::X10_EVENT_PROJECT_ID, self::X10_EVENT_OBJECT_KEY_NUM, $this->event->getCategory()); // Event Type / Action $x10->setKey(self::X10_EVENT_PROJECT_ID, self::X10_EVENT_TYPE_KEY_NUM, $this->event->getAction()); if ($this->event->getLabel() !== null) { // Event Description / Label $x10->setKey(self::X10_EVENT_PROJECT_ID, self::X10_EVENT_LABEL_KEY_NUM, $this->event->getLabel()); } if ($this->event->getValue() !== null) { $x10->setValue(self::X10_EVENT_PROJECT_ID, self::X10_EVENT_VALUE_VALUE_NUM, $this->event->getValue()); } $p->utme .= $x10->renderUrlString(); if ($this->event->getNoninteraction()) { $p->utmni = 1; } return $p; }
/** * @link http://xahlee.org/js/google_analytics_tracker_2010-07-01_expanded.js line 575 * @param \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder $p * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildCustomVariablesParameter(ParameterHolder $p) { $customVars = $this->tracker->getCustomVariables(); if ($customVars) { if (count($customVars) > 5) { // See http://code.google.com/intl/de-DE/apis/analytics/docs/tracking/gaTrackingCustomVariables.html#usage Tracker::_raiseError('The sum of all custom variables cannot exceed 5 in any given request.', __METHOD__); } $x10 = new X10(); $x10->clearKey(self::X10_CUSTOMVAR_NAME_PROJECT_ID); $x10->clearKey(self::X10_CUSTOMVAR_VALUE_PROJECT_ID); $x10->clearKey(self::X10_CUSTOMVAR_SCOPE_PROJECT_ID); foreach ($customVars as $customVar) { // Name and value get encoded here, // see http://xahlee.org/js/google_analytics_tracker_2010-07-01_expanded.js line 563 $name = Util::encodeUriComponent($customVar->getName()); $value = Util::encodeUriComponent($customVar->getValue()); $x10->setKey(self::X10_CUSTOMVAR_NAME_PROJECT_ID, $customVar->getIndex(), $name); $x10->setKey(self::X10_CUSTOMVAR_VALUE_PROJECT_ID, $customVar->getIndex(), $value); if ($customVar->getScope() !== null && $customVar->getScope() != CustomVariable::SCOPE_PAGE) { $x10->setKey(self::X10_CUSTOMVAR_SCOPE_PROJECT_ID, $customVar->getIndex(), $customVar->getScope()); } } $p->utme .= $x10->renderUrlString(); } return $p; }