Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Version 0.7.3 Beta
Browse files Browse the repository at this point in the history
Minor update, store all information related to the event in one place
  • Loading branch information
Tom Chapman committed Jan 6, 2012
1 parent db2a9c2 commit 07cfac5
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions GoogleAnalyticsServerSide.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 07cfac5

Please sign in to comment.