PHP Класс Piwik\Plugins\API\API

Some of the information that is returned by the Metadata API:
  • the dynamically generated list of all API methods via "getReportMetadata"
  • the list of metrics that will be returned by each method, along with their human readable name, via "getDefaultMetrics" and "getDefaultProcessedMetrics"
  • the list of segments metadata supported by all functions that have a 'segment' parameter
  • the (truly magic) method "getProcessedReport" will return a human readable version of any other report, and include the processed metrics such as conversion rate, time on site, etc. which are not directly available in other methods.
  • the method "getSuggestedValuesForSegment" returns top suggested values for a particular segment. It uses the Live.getLastVisitsDetails API to fetch the most recently used values, and will return the most often used values first.
The Metadata API is for example used by the Piwik Mobile App to automatically display all Piwik reports, with translated report & columns names and nicely formatted values. More information on the Metadata API documentation page
Наследование: extends Piwik\Plugin\API
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( SettingsProvider $settingsProvider, ProcessedReport $processedReport )
get ( $idSite, $period, $date, $segment = false, $columns = false ) Get a combined report of the *.get API methods.
getAvailableMeasurableTypes ( ) : array Returns all available measurable types.
getBulkRequest ( array $urls ) : array Performs multiple API requests at once and returns every result.
getDefaultMetricTranslations ( ) : array Default translations for many core metrics.
getGlossaryMetrics ( $idSite ) : array A glossary of all metrics and their definition
getGlossaryReports ( $idSite ) : array A glossary of all reports and their definition
getHeaderLogoUrl ( boolean $pathOnly = false ) : string Returns the url to header logo (~127x50px)
getIpFromHeader ( ) : string Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address.
getLogoUrl ( boolean $pathOnly = false ) : string Returns the url to application logo (~280x110px)
getMetadata ( $idSite, $apiModule, $apiAction, $apiParameters = [], $language = false, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false ) Loads reports metadata, then return the requested one, matching optional API parameters.
getPiwikVersion ( ) : string Get Piwik version
getProcessedReport ( $idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true, $hideMetricsDoc = false, $idSubtable = false, $showRawMetrics = false, $format_metrics = null, $idDimension = false )
getReportMetadata ( string $idSites = '', boolean | string $period = false, boolean | Date $date = false, boolean $hideMetricsDoc = false, boolean $showSubtableReports = false, integer $idSite = false ) : array Triggers a hook to ask plugins for available Reports.
getReportPagesMetadata ( integer $idSite ) : array Get a list of all pages that shall be shown in a Piwik UI including a list of all widgets that shall be shown within each page.
getRowEvolution ( integer $idSite, string $period, Date $date, string $apiModule, string $apiAction, boolean | string $label = false, boolean | string $segment = false, boolean | string $column = false, boolean | string $language = false, boolean | integer $idGoal = false, boolean | string $legendAppendMetric = true, boolean | string $labelUseAbsoluteUrl = true, boolean | integer $idDimension = false ) : array Given an API report to query (eg. "Referrers.getKeywords", and a Label (eg. "free%20software"), this function will query the API for the previous days/weeks/etc. and will return a ready to use data structure containing the metrics for the requested Label, along with enriched information (min/max values, etc.)
getSVGLogoUrl ( boolean $pathOnly = false ) : string Returns the URL to application SVG Logo
getSegmentsMetadata ( $idSites = [], $_hideImplementationData = true )
getSettings ( ) : array Returns the section [APISettings] if defined in config.ini.php
getSuggestedValuesForSegment ( $segmentName, $idSite ) : array Given a segment, will return a list of the most used values for this particular segment.
getWidgetMetadata ( integer $idSite ) : array Get a list of all widgetizable widgets.
hasSVGLogo ( ) : boolean Returns whether there is an SVG Logo available.
isPluginActivated ( string $pluginName ) : boolean Return true if plugin is activated, false otherwise

Защищенные методы

Метод Описание
doesSegmentNeedActionsData ( $segmentName ) : boolean
getSegmentValuesFromVisitorLog ( $segmentName, $table ) : array

Приватные методы

Метод Описание
doesSuggestedValuesCallbackNeedData ( $suggestedValuesCallback )
findSegment ( $segmentName, $idSite )
getMostFrequentValues ( $values ) : array
getSuggestedValuesForSegmentName ( $idSite, $segment, $maxSuggestionsToReturn )

Описание методов

__construct() публичный Метод

public __construct ( SettingsProvider $settingsProvider, ProcessedReport $processedReport )
$settingsProvider Piwik\Plugin\SettingsProvider
$processedReport ProcessedReport

doesSegmentNeedActionsData() защищенный Метод

protected doesSegmentNeedActionsData ( $segmentName ) : boolean
$segmentName
Результат boolean

get() публичный Метод

Get a combined report of the *.get API methods.
public get ( $idSite, $period, $date, $segment = false, $columns = false )

getAvailableMeasurableTypes() публичный Метод

Marked as deprecated so it won't appear in API page. It won't be a public API for now.
Устаревший:
public getAvailableMeasurableTypes ( ) : array
Результат array

getBulkRequest() публичный Метод

Performs multiple API requests at once and returns every result.
public getBulkRequest ( array $urls ) : array
$urls array The array of API requests.
Результат array

getDefaultMetricTranslations() публичный Метод

This is used for exports with translated labels. The exports contain columns that are not visible in the UI and not present in the API meta data. These columns are translated here.
Устаревший: since Piwik 2.15.1
public getDefaultMetricTranslations ( ) : array
Результат array

getGlossaryMetrics() публичный Метод

A glossary of all metrics and their definition
public getGlossaryMetrics ( $idSite ) : array
$idSite
Результат array

getGlossaryReports() публичный Метод

A glossary of all reports and their definition
public getGlossaryReports ( $idSite ) : array
$idSite
Результат array

getHeaderLogoUrl() публичный Метод

Returns the url to header logo (~127x50px)
Устаревший: since Piwik 2.15.1
public getHeaderLogoUrl ( boolean $pathOnly = false ) : string
$pathOnly boolean If true, returns path relative to doc root. Otherwise, returns a URL.
Результат string

getIpFromHeader() публичный Метод

Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address.
public getIpFromHeader ( ) : string
Результат string IP address in presentation format.

getLogoUrl() публичный Метод

Returns the url to application logo (~280x110px)
Устаревший: since Piwik 2.15.1
public getLogoUrl ( boolean $pathOnly = false ) : string
$pathOnly boolean If true, returns path relative to doc root. Otherwise, returns a URL.
Результат string

getMetadata() публичный Метод

Loads reports metadata, then return the requested one, matching optional API parameters.
public getMetadata ( $idSite, $apiModule, $apiAction, $apiParameters = [], $language = false, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false )

getPiwikVersion() публичный Метод

Get Piwik version
public getPiwikVersion ( ) : string
Результат string

getProcessedReport() публичный Метод

public getProcessedReport ( $idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true, $hideMetricsDoc = false, $idSubtable = false, $showRawMetrics = false, $format_metrics = null, $idDimension = false )

getReportMetadata() публичный Метод

Returns metadata information about each report (category, name, dimension, metrics, etc.)
public getReportMetadata ( string $idSites = '', boolean | string $period = false, boolean | Date $date = false, boolean $hideMetricsDoc = false, boolean $showSubtableReports = false, integer $idSite = false ) : array
$idSites string THIS PARAMETER IS DEPRECATED AND WILL BE REMOVED IN PIWIK 4
$period boolean | string
$date boolean | Piwik\Date
$hideMetricsDoc boolean
$showSubtableReports boolean
$idSite integer
Результат array

getReportPagesMetadata() публичный Метод

Get a list of all pages that shall be shown in a Piwik UI including a list of all widgets that shall be shown within each page.
public getReportPagesMetadata ( integer $idSite ) : array
$idSite integer
Результат array

getRowEvolution() публичный Метод

Given an API report to query (eg. "Referrers.getKeywords", and a Label (eg. "free%20software"), this function will query the API for the previous days/weeks/etc. and will return a ready to use data structure containing the metrics for the requested Label, along with enriched information (min/max values, etc.)
public getRowEvolution ( integer $idSite, string $period, Date $date, string $apiModule, string $apiAction, boolean | string $label = false, boolean | string $segment = false, boolean | string $column = false, boolean | string $language = false, boolean | integer $idGoal = false, boolean | string $legendAppendMetric = true, boolean | string $labelUseAbsoluteUrl = true, boolean | integer $idDimension = false ) : array
$idSite integer
$period string
$date Piwik\Date
$apiModule string
$apiAction string
$label boolean | string
$segment boolean | string
$column boolean | string
$language boolean | string
$idGoal boolean | integer
$legendAppendMetric boolean | string
$labelUseAbsoluteUrl boolean | string
$idDimension boolean | integer
Результат array

getSVGLogoUrl() публичный Метод

Returns the URL to application SVG Logo
public getSVGLogoUrl ( boolean $pathOnly = false ) : string
$pathOnly boolean If true, returns path relative to doc root. Otherwise, returns a URL.
Результат string

getSegmentValuesFromVisitorLog() защищенный Метод

protected getSegmentValuesFromVisitorLog ( $segmentName, $table ) : array
$segmentName
$table
Результат array

getSegmentsMetadata() публичный Метод

public getSegmentsMetadata ( $idSites = [], $_hideImplementationData = true )

getSettings() публичный Метод

Returns the section [APISettings] if defined in config.ini.php
public getSettings ( ) : array
Результат array

getSuggestedValuesForSegment() публичный Метод

Given a segment, will return a list of the most used values for this particular segment.
public getSuggestedValuesForSegment ( $segmentName, $idSite ) : array
$segmentName
$idSite
Результат array

getWidgetMetadata() публичный Метод

Get a list of all widgetizable widgets.
public getWidgetMetadata ( integer $idSite ) : array
$idSite integer
Результат array

isPluginActivated() публичный Метод

Return true if plugin is activated, false otherwise
public isPluginActivated ( string $pluginName ) : boolean
$pluginName string
Результат boolean