public function Event::getSettingCommands in Googalytics - Google Analytics 8
An array of commands to be sent to Google Analytics.
Return value
array An array of command values.
Overrides Send::getSettingCommands
File
- src/
AnalyticsCommand/ Event.php, line 73
Class
- Event
- Class Event.
Namespace
Drupal\ga\AnalyticsCommandCode
public function getSettingCommands() {
$command = [
($this->trackerName ? $this->trackerName . '.' : '') . $this->command,
$this->hitType,
$this->eventCategory,
$this->eventAction,
];
$fieldsObject = $this->fieldsObject;
if (!empty($this->eventLabel)) {
$command[] = $this->eventLabel;
if (!is_null($this->eventValue)) {
$command[] = $this->eventValue;
}
}
elseif (!is_null($this->eventValue)) {
// If label is not specified but value is, the value must be set in
// fieldsObject instead.
$fieldsObject['eventValue'] = $this->eventValue;
}
if (!empty($fieldsObject)) {
$command[] = $fieldsObject;
}
return [
$command,
];
}