/** * @param string $path */ public function setPath($path) { if ($path && $path[0] != '/') { Tracker::_raiseError('The page path should always start with a slash ("/").', __METHOD__); } $this->path = $path; }
/** * @param array $properties */ public function __construct(array $properties = array()) { foreach ($properties as $property => $value) { // PHP doesn't care about case in method names $setterMethod = 'set' . $property; if (method_exists($this, $setterMethod)) { $this->{$setterMethod}($value); } else { return Tracker::_raiseError('There is no setting "' . $property . '".', __METHOD__); } } }
public function validate() { if ($this->network === null || $this->action === null) { Tracker::_raiseError('Social interactions need to have at least the "network" and "action" attributes defined.', __METHOD__); } }
/** * @param int $loadTime */ public function setLoadTime($loadTime) { if ((int) $loadTime != (double) $loadTime) { return Tracker::_raiseError('Page load time must be specified in integer milliseconds.', __METHOD__); } $this->loadTime = (int) $loadTime; }
public function validate() { if ($this->sku === null) { Tracker::_raiseError('Items need to have a sku/product code defined.', __METHOD__); } }
/** * @param int $sitespeedSampleRate */ public function setSitespeedSampleRate($sitespeedSampleRate) { if ((int) $sitespeedSampleRate != (double) $sitespeedSampleRate || $sitespeedSampleRate < 0 || $sitespeedSampleRate > 100) { return Tracker::_raiseError('For consistency with ga.js, sample rates must be specified as a number between 0 and 100.', __METHOD__); } $this->sitespeedSampleRate = (int) $sitespeedSampleRate; }
public function validate() { if ($this->category === null || $this->action === null) { Tracker::_raiseError('Events need at least to have a category and action defined.', __METHOD__); } }
public function validate() { if (!$this->items) { Tracker::_raiseError('Transactions need to consist of at least one item.', __METHOD__); } }