Create.php in Googalytics - Google Analytics 8
File
src/AnalyticsCommand/Create.php
View source
<?php
namespace Drupal\ga\AnalyticsCommand;
class Create extends Generic {
const DEFAULT_PRIORITY = 300;
protected $trackingId;
protected $cookieDomain;
public function __construct($tracking_id, $cookie_domain = 'auto', $tracker_name = NULL, array $fields_object = [], $priority = self::DEFAULT_PRIORITY) {
parent::__construct('create', $fields_object, $tracker_name, $priority);
$this->trackingId = $tracking_id;
$this->cookieDomain = $cookie_domain;
}
public function getTrackingId() {
return $this->trackingId;
}
public function getCookieDomain() {
return $this->cookieDomain;
}
public function getSettingCommands() {
$command = [
$this->command,
$this->trackingId,
$this->cookieDomain,
];
if (!empty($this->trackerName)) {
$command[] = $this->trackerName;
}
if (!empty($this->fieldsObject)) {
$command[] = $this->fieldsObject;
}
return [
$command,
];
}
}