Skip to content

Commit

Permalink
Creating setAsyncRequest(boolean $isAsyncRequest) method to be used i…
Browse files Browse the repository at this point in the history
…nstead of

makeNonBlockingRequest()
  • Loading branch information
jorgeborges committed Mar 7, 2015
1 parent 0cabbe0 commit 3737b92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Analytics
*
* @var boolean
*/
private $isNonBlocking;
private $isAsyncRequest = false;

/**
* Endpoint to connect to when sending data to GA.
Expand Down Expand Up @@ -222,19 +222,32 @@ public function __construct($isSsl = false)
$this->endpoint = str_replace('www', 'ssl', $this->endpoint);
}

$this->isNonBlocking = false;

$this->availableParameters = $this->getAvailableParameters();
}

/**
* Sets a request to be either synchronous or asynchronous (non-blocking).
*
* @param boolean $isAsyncRequest
* @return $this
*/
public function setAsyncRequest($isAsyncRequest)
{
$this->isAsyncRequest = $isAsyncRequest;

return $this;
}

/**
* Makes the request to GA asynchronous (non-blocking).
*
* @deprecated Use setAsyncRequest(boolean $isAsyncRequest) instead. To be removed in the major version.
*
* @return $this
*/
public function makeNonBlocking()
{
$this->isNonBlocking = true;
$this->isAsyncRequest = true;

return $this;
}
Expand Down Expand Up @@ -334,7 +347,7 @@ private function sendHit($methodName)
$this->getEndpoint(),
$this->singleParameters,
$this->compoundParametersCollections,
$this->isNonBlocking
$this->isAsyncRequest
);
}

Expand Down
1 change: 1 addition & 0 deletions tests/TheIconic/Tracking/GoogleAnalytics/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function testSendSimpleSslHit()
);

$this->analyticsSsl
->setAsyncRequest(true)
->setProtocolVersion('1')
->setTrackingId('555')
->setClientId('666')
Expand Down

0 comments on commit 3737b92

Please sign in to comment.