doBulkTrack() public method

To enable bulk tracking, call enableBulkTracking().
public doBulkTrack ( ) : string
return string Response
 public function test_response_ShouldContainBulkTrackingApiResponse()
 {
     $this->tracker->doTrackPageView('Test');
     $this->tracker->doTrackPageView('Test');
     // test skipping invalid site errors
     $this->tracker->setIdSite(5);
     $this->tracker->doTrackPageView('Test');
     $response = $this->tracker->doBulkTrack();
     $this->assertEquals('{"status":"success","tracked":2,"invalid":1}', $response);
 }
Example #2
0
 public function test_response_ShouldContainBulkTrackingApiResponse()
 {
     $this->tracker->doTrackPageView('Test');
     $this->tracker->doTrackPageView('Test');
     // test skipping invalid site errors
     $this->tracker->setIdSite(5);
     $this->tracker->doTrackPageView('Test');
     $this->tracker->setIdSite(1);
     $this->tracker->doTrackPageView('Test');
     // another invalid one to further test the invalid request indices in the result
     $this->tracker->setIdSite(7);
     $this->tracker->doTrackPageView('Test');
     $response = $this->tracker->doBulkTrack();
     $this->assertEquals('{"status":"success","tracked":3,"invalid":2,"invalid_indices":[2,4]}', $response);
 }
 private function doTrackNumberOfRequests($numRequests, $inBulk = true)
 {
     $inBulk && $this->tracker->enableBulkTracking();
     for ($i = 0; $i < $numRequests; $i++) {
         $response = $this->tracker->doTrackPageView('Test');
     }
     if ($inBulk) {
         $response = $this->tracker->doBulkTrack();
     }
     return $response;
 }