diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
index b516623fe2375cc1844e3171cb915d6da411b8c9..1359a4bb3ea1702bf033dcbfc6dece05eb1a9334 100644
--- a/libs/PiwikTracker/PiwikTracker.php
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -341,17 +341,18 @@ class PiwikTracker
      */
     public function doBulkTrack()
     {
-    	if (empty($this->storedTrackingActions))
+    	if (empty($this->token_auth))
     	{
-    		return '';
+    		throw new Exception("Token auth is required for bulk tracking.");
     	}
     	
-    	$data = array('requests' => $this->storedTrackingActions);
-    	if (!empty($this->token_auth))
+    	if (empty($this->storedTrackingActions))
     	{
-    		$data['token_auth'] = $this->token_auth;
+    		return '';
     	}
     	
+    	$data = array('requests' => $this->storedTrackingActions, 'token_auth' => $this->token_auth);
+		
     	$postData = json_encode($data);
     	$response = $this->sendRequest($this->getBaseUrl(), 'POST', $postData, $force = true);
     	
diff --git a/tests/integration/TwoVisitors_TwoWebsites_DifferentDays.test.php b/tests/integration/TwoVisitors_TwoWebsites_DifferentDays.test.php
index a1993436657aa69956895411dc605a472fdb7b97..1fde27e36cffe6175cdaea67d1531a47b63d8273 100755
--- a/tests/integration/TwoVisitors_TwoWebsites_DifferentDays.test.php
+++ b/tests/integration/TwoVisitors_TwoWebsites_DifferentDays.test.php
@@ -127,7 +127,10 @@ class Test_Piwik_Integration_TwoVisitors_TwoWebsites_DifferentDays extends Test_
 		// Second new visitor on Idsite 1: one page view 
 		$visitorB = $this->getTracker($idSite, $dateTime, $defaultInit = true);
 		$visitorB->enableBulkTracking();
-		$visitorB->setTokenAuth(Piwik::getCurrentUserTokenAuth());
+		// calc token auth by hand in test environment
+		$tokenAuth = md5(
+			Piwik_Config::getInstance()->superuser['login'].Piwik_Config::getInstance()->superuser['password']);
+		$visitorB->setTokenAuth($tokenAuth);
 		$visitorB->setIp('100.52.156.83');
 		$visitorB->setResolution(800, 300);
 		$visitorB->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(1)->getDatetime());