class Timing in Googalytics - Google Analytics 8
Class Timing.
Hierarchy
- class \Drupal\ga\AnalyticsCommand\Generic implements DrupalSettingCommandsInterface uses DrupalSettingCommandsTrait
Expanded class hierarchy of Timing
File
- src/
AnalyticsCommand/ Timing.php, line 8
Namespace
Drupal\ga\AnalyticsCommandView source
class Timing extends Send {
/**
* A string for categorizing all user timing variables into logical groups.
*
* @var string
*/
protected $timingCategory;
/**
* A string to identify the variable being recorded.
*
* @var string
*/
protected $timingVar;
/**
* The number of milliseconds in elapsed time.
*
* @var int
*/
protected $timingValue;
/**
* A string that can be used to add flexibility in visualizing user timings.
*
* @var null|string
*/
protected $timingLabel;
/**
* Create constructor.
*
* @param string $category
* A string for categorizing all user timing variables into logical groups.
* @param string $var
* A string to identify the variable being recorded.
* @param int $value
* The number of milliseconds in elapsed time.
* @param string|null $label
* A string that can be used to add flexibility in visualizing user timings
* in the reports.
* @param array $fields_object
* A map of values for the command's fieldsObject parameter.
* @param string $tracker_name
* The tracker name (optional).
* @param int $priority
* The command priority.
*/
public function __construct($category, $var, $value, $label = NULL, array $fields_object = [], $tracker_name = NULL, $priority = self::DEFAULT_PRIORITY) {
$this->timingCategory = $category;
$this->timingVar = $var;
if (!is_int($value)) {
throw new \InvalidArgumentException("Timing value must be an integer");
}
$this->timingValue = $value;
$this->timingLabel = $label;
parent::__construct('timing', $fields_object, $tracker_name, $priority);
}
/**
* {@inheritdoc}
*/
public function getSettingCommands() {
$command = [
($this->trackerName ? $this->trackerName . '.' : '') . $this->command,
$this->hitType,
$this->timingCategory,
$this->timingVar,
$this->timingValue,
];
if (!is_null($this->timingLabel)) {
$command[] = $this->timingLabel;
}
if (!empty($this->fieldsObject)) {
$command[] = $this->fieldsObject;
}
return [
$command,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalSettingCommandsTrait:: |
protected | property | Priority integer. | |
DrupalSettingCommandsTrait:: |
public | function | An integer value for sorting by priority. | |
Generic:: |
protected | property | The command name. | |
Generic:: |
protected | property | A map of values for the command's fieldsObject parameter. | |
Generic:: |
protected | property | The name of the tracker for this command. | |
Generic:: |
public | function | Get the command name. | |
Generic:: |
public | function | Get the map of values for the command's fieldsObject parameter. | |
Generic:: |
public | function | The tracker this command will be applied to, if specified. | |
Send:: |
protected | property | The event hitType parameter. | |
Send:: |
private static | property | ||
Send:: |
constant |
Overrides Generic:: |
1 | |
Timing:: |
protected | property | A string for categorizing all user timing variables into logical groups. | |
Timing:: |
protected | property | A string that can be used to add flexibility in visualizing user timings. | |
Timing:: |
protected | property | The number of milliseconds in elapsed time. | |
Timing:: |
protected | property | A string to identify the variable being recorded. | |
Timing:: |
public | function |
An array of commands to be sent to Google Analytics. Overrides Send:: |
|
Timing:: |
public | function |
Create constructor. Overrides Send:: |