The method "getLastVisitsDetails" will return extensive data for each visit, which includes: server time, visitId, visitorId, visitorType (new or returning), number of pages, list of all pages (and events, file downloaded and outlinks clicked), custom variables names and values set to this visit, number of goal conversions (and list of all Goal conversions for this visit, with time of conversion, revenue, URL, etc.), but also other attributes such as: days since last visit, days since first visit, country, continent, visitor IP, provider, referrer used (referrer name, keyword if it was a search engine, full URL), campaign name and keyword, operating system, browser, type of screen, resolution, supported browser plugins (flash, java, silverlight, pdf, etc.), various dates & times format to make it easier for API users... and more! With the parameter '&segment=' you can filter the returned visits by any criteria (visitor IP, visitor ID, country, keyword used, time of day, etc.). The method "getCounters" is used to return a simple counter: visits, number of actions, number of converted visits, in the last N minutes. See also the documentation about Real time widget and visitor level reports in Piwik.
Inheritance: extends piwik\plugin\API
Esempio n. 1
0
 public function test_GetCounters_ShouldOnlyReturnResultsOfLastMinutes()
 {
     $this->trackSomeVisits();
     $counters = $this->api->getCounters($this->idSite, 5);
     $this->assertEquals($this->buildCounter(19, 32, 16, 16), $counters);
     $counters = $this->api->getCounters($this->idSite, 20);
     $this->assertEquals($this->buildCounter(24, 60, 20, 40), $counters);
     $counters = $this->api->getCounters($this->idSite, 0);
     $this->assertEquals($this->buildCounter(0, 0, 0, 0), $counters);
 }
Esempio n. 2
0
 private function setCounters($view)
 {
     $segment = Request::getRawSegmentFromRequest();
     $last30min = API::getInstance()->getCounters($this->idSite, $lastMinutes = 30, $segment, array('visits', 'actions'));
     $last30min = $last30min[0];
     $today = API::getInstance()->getCounters($this->idSite, $lastMinutes = 24 * 60, $segment, array('visits', 'actions'));
     $today = $today[0];
     $view->visitorsCountHalfHour = $last30min['visits'];
     $view->visitorsCountToday = $today['visits'];
     $view->pisHalfhour = $last30min['actions'];
     $view->pisToday = $today['actions'];
     return $view;
 }
Esempio n. 3
0
 public function test_GetCounters_ShouldHideColumnIfGivenInShowAndHide()
 {
     $counters = $this->api->getCounters($this->idSite, 20, false, array('visits', 'actions'), array('actions'));
     $this->assertEquals(array(array('visits' => 24)), $counters);
 }
Esempio n. 4
0
 public function getSingleVisitSummary()
 {
     $view = new View('@Live/getSingleVisitSummary.twig');
     $visits = Request::processRequest('Live.getLastVisitsDetails', array('segment' => 'visitId==' . Common::getRequestVar('visitId'), 'period' => false, 'date' => false));
     $view->visitData = $visits->getFirstRow()->getColumns();
     $view->visitReferralSummary = API::getReferrerSummaryForVisit($visits->getFirstRow());
     $view->showLocation = true;
     $this->setWidgetizedVisitorProfileUrl($view);
     $view->exportLink = $this->getVisitorProfileExportLink();
     return $view->render();
 }