diff options
author | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-09-08 23:54:52 +0400 |
---|---|---|
committer | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-09-08 23:54:52 +0400 |
commit | 67c297348362e167d9bd4660c2b6512a63e26537 (patch) | |
tree | 493434eda23a31cf33af1de0e54ef149a09208f3 /core | |
parent | f985d168e35b38f4c84d09d72430a2f46d1c1b00 (diff) |
Return JSON string on error in bulk tracking
Return JSON string with statistics on success
fixes #4141
Diffstat (limited to 'core')
-rw-r--r-- | core/Tracker.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/Tracker.php b/core/Tracker.php index 82997c2c97..40fcdccbec 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -388,10 +388,12 @@ class Tracker { if ($this->usingBulkTracking) { // when doing bulk tracking we return JSON so the caller will know how many succeeded - $result = array('succeeded' => $this->countOfLoggedRequests); + $result = array('status' => 'error', 'statistics' => array( + 'tracked' => $this->countOfLoggedRequests + )); // send error when in debug mode or when authenticated (which happens when doing log importing, if ((isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) || $authenticated) { - $result['error'] = $this->getMessageFromException($e); + $result['message'] = $this->getMessageFromException($e); } $this->sendHeader('Content-Type: application/json'); echo Common::json_encode($result); @@ -445,6 +447,14 @@ class Tracker */ protected function end() { + if($this->usingBulkTracking) { + $result = array('status' => 'success', 'statistics' => array( + 'tracked' => $this->countOfLoggedRequests + )); + $this->sendHeader('Content-Type: application/json'); + echo Common::json_encode($result); + exit; + } switch ($this->getState()) { case self::STATE_LOGGING_DISABLE: $this->outputTransparentGif(); |