PHP Class Piwik\Plugins\Live\API

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
Exibir arquivo Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
__construct ( Psr\Log\LoggerInterface $logger )
getCounters ( integer $idSite, integer $lastMinutes, boolean | string $segment = false, array $showColumns = [], array $hideColumns = [] ) : array( This will return simple counters, for a given website ID, for visits over the last N minutes
getLastVisits ( $idSite, $filter_limit = 10, $minTimestamp = false )
getLastVisitsDetails ( integer $idSite, boolean | string $period = false, boolean | string $date = false, boolean | integer $segment = false, boolean | integer $countVisitorsToFetch = false, boolean | integer $minTimestamp = false, boolean $flat = false, boolean $doNotFetchActions = false ) : DataTable Returns the last visits tracked in the specified website You can define any number of filters: none, one, many or all parameters can be defined
getLastVisitsForVisitor ( integer $visitorId, integer $idSite, integer $filter_limit = 10, boolean $flat = false ) : DataTable The same functionality can be obtained using segment=visitorId==$visitorId with getLastVisitsDetails
getMostRecentVisitorId ( integer $idSite, boolean | string $segment = false ) : string Returns the visitor ID of the most recent visit.
getVisitorProfile ( integer $idSite, boolean | false | string $visitorId = false, boolean | false | string $segment = false, boolean | false | integer $limitVisits = false ) : array Returns an array describing a visitor using her last visits (uses a maximum of 100).

Private Methods

Method Description
addFilterToCleanVisitors ( DataTable $dataTable, integer $idSite, boolean $flat = false, boolean $doNotFetchActions = false, boolean $filterNow = false ) For an array of visits, query the list of pages for this visit as well as make the data human readable
loadLastVisitorDetailsFromDatabase ( $idSite, $period, $date, $segment = false, $offset, $limit = 100, $minTimestamp = false, $filterSortOrder = false, $visitorId = false )
makeVisitorTableFromArray ( $data ) : DataTable
shouldColumnBePresentInResponse ( $column, $showColumns, $hideColumns )

Method Details

__construct() public method

public __construct ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

getCounters() public method

This will return simple counters, for a given website ID, for visits over the last N minutes
public getCounters ( integer $idSite, integer $lastMinutes, boolean | string $segment = false, array $showColumns = [], array $hideColumns = [] ) : array(
$idSite integer Id Site
$lastMinutes integer Number of minutes to look back at
$segment boolean | string
$showColumns array The columns to show / not to request. Eg 'visits', 'actions', ...
$hideColumns array The columns to hide / not to request. Eg 'visits', 'actions', ...
return array(

getLastVisits() public method

Deprecation:
public getLastVisits ( $idSite, $filter_limit = 10, $minTimestamp = false )

getLastVisitsDetails() public method

Returns the last visits tracked in the specified website You can define any number of filters: none, one, many or all parameters can be defined
public getLastVisitsDetails ( integer $idSite, boolean | string $period = false, boolean | string $date = false, boolean | integer $segment = false, boolean | integer $countVisitorsToFetch = false, boolean | integer $minTimestamp = false, boolean $flat = false, boolean $doNotFetchActions = false ) : DataTable
$idSite integer Site ID
$period boolean | string Period to restrict to when looking at the logs
$date boolean | string Date to restrict to
$segment boolean | integer (optional) Number of visits rows to return
$countVisitorsToFetch boolean | integer DEPRECATED (optional) Only return the last X visits. Please use the API paramaeter 'filter_offset' and 'filter_limit' instead.
$minTimestamp boolean | integer (optional) Minimum timestamp to restrict the query to (useful when paginating or refreshing visits)
$flat boolean
$doNotFetchActions boolean
return Piwik\DataTable

getLastVisitsForVisitor() public method

The same functionality can be obtained using segment=visitorId==$visitorId with getLastVisitsDetails
Deprecation:
public getLastVisitsForVisitor ( integer $visitorId, integer $idSite, integer $filter_limit = 10, boolean $flat = false ) : DataTable
$visitorId integer
$idSite integer
$filter_limit integer
$flat boolean Whether to flatten the visitor details array
return Piwik\DataTable

getMostRecentVisitorId() public method

Returns the visitor ID of the most recent visit.
public getMostRecentVisitorId ( integer $idSite, boolean | string $segment = false ) : string
$idSite integer
$segment boolean | string
return string

getVisitorProfile() public method

Returns an array describing a visitor using her last visits (uses a maximum of 100).
public getVisitorProfile ( integer $idSite, boolean | false | string $visitorId = false, boolean | false | string $segment = false, boolean | false | integer $limitVisits = false ) : array
$idSite integer Site ID
$visitorId boolean | false | string The ID of the visitor whose profile to retrieve.
$segment boolean | false | string
$limitVisits boolean | false | integer
return array