diff --git a/GoogleAnalyticsServerSide.php b/GoogleAnalyticsServerSide.php index 53c2c10..6fe5f29 100755 --- a/GoogleAnalyticsServerSide.php +++ b/GoogleAnalyticsServerSide.php @@ -154,15 +154,6 @@ class GoogleAnalyticsServerSide private $event = array(); - /** - * Whether the event is a non-interaction or not - * - * @var boolean - * @access private - */ - private $nonInteraction = false; - - /** * Data for the custom variables * @@ -556,11 +547,11 @@ public function setEvent($category, $action, $label = null, $value = null, $nonI if (!is_bool($nonInteraction)) { throw new InvalidArgumentException('NonInteraction must be a boolean.'); } - $this->event = array( 'category' => $category - , 'action' => $action - , 'label' => $label - , 'value' => $value); - $this->nonInteraction = $nonInteraction; + $this->event = array( 'category' => $category + , 'action' => $action + , 'label' => $label + , 'value' => $value + , 'nonInteraction'=> $nonInteraction); return $this; } @@ -706,7 +697,7 @@ public function setOption($name, $value) { public function getEventString() { $event = $this->getEvent(); $value = $event['value']; - unset($event['value']); + unset($event['value'], $event['nonInteraction']); $eventValues = array(); foreach ($event as $key => $value) { if (!empty($value)) { @@ -1012,7 +1003,8 @@ public function createEvent($category = null, $action = null, $label = null, $va } $queryParams = array( 'utmt' => 'event' , 'utme' => $this->getEventString()); - if ($this->nonInteraction === true) { + $event = $this->getEvent(); + if ($event['nonInteraction'] === true) { $queryParams['utmni'] = '1'; } return $this->track($queryParams);