Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-04-23 10:58:29 +0400
committermattab <matthieu.aubry@gmail.com>2014-04-23 10:58:29 +0400
commit2acb364552e1ba3184bd18d3541736e9b1ef9219 (patch)
treecdf657b7d11cc4bc980adb2bd89ea2cb9b6fbe70 /libs/PiwikTracker
parenta24594f869cdfb7f74b68fe747ff5d9c244ded84 (diff)
Fixes #5030 Tracking API now does not require token_auth for bulk requests.
To make behavior the same as in Piwik 2.1.0 or earlier, set the following config setting under [Tracker]: ; Whether Bulk tracking requests to the Tracking API requires the token_auth to be set. bulk_requests_require_authentication = 1
Diffstat (limited to 'libs/PiwikTracker')
-rw-r--r--libs/PiwikTracker/PiwikTracker.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
index ba790c77b0..a62feb7a8b 100644
--- a/libs/PiwikTracker/PiwikTracker.php
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -627,15 +627,16 @@ class PiwikTracker
*/
public function doBulkTrack()
{
- if (empty($this->token_auth)) {
- throw new Exception("Token auth is required for bulk tracking.");
- }
-
if (empty($this->storedTrackingActions)) {
throw new Exception("Error: you must call the function doTrackPageView or doTrackGoal from this class, before calling this method doBulkTrack()");
}
- $data = array('requests' => $this->storedTrackingActions, 'token_auth' => $this->token_auth);
+ $data = array('requests' => $this->storedTrackingActions);
+
+ // token_auth is not required by default, except if bulk_requests_require_authentication=1
+ if(!empty($this->token_auth)) {
+ $data['token_auth'] = $this->token_auth;
+ }
$postData = json_encode($data);
$response = $this->sendRequest($this->getBaseUrl(), 'POST', $postData, $force = true);