프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$action | string | The name of the action. The action is detected automatically depending on the file name. A corresponding action should exist in the API as well. | |
$actionToLoadSubTables | string | The name of the API action to load a subtable if supported. The action has to be of the same module. For instance a report "getKeywords" might support a subtable "getSearchEngines" which shows how often a keyword was searched via a specific search engine. | |
$categoryId | string | The translation key of the category the report belongs to. | |
$constantRowsCount | boolean | Set it to boolean true if your report always returns a constant count of rows, for instance always 24 rows for 1-24 hours. | |
$defaultSortColumn | string | integer | Default sort column. Either a column name or a column id. | |
$defaultSortOrderDesc | boolean | Default sort desc. If true will sort by default desc, if false will sort by default asc | |
$dimension | An instance of a dimension if the report has one. You can create a new dimension using the Piwik console CLI tool if needed. | ||
$documentation | string | A translated documentation which explains the report. | |
$hasGoalMetrics | boolean | Set this property to true in case your report supports goal metrics. In this case, the goal metrics will be automatically added to the report metadata and the report will be displayed in the Goals UI. | |
$isSubtableReport | boolean | Set it to boolean true if this report is a subtable report and won't be used as a standalone report. | |
$metrics | array | ..)`. Defaults to the platform default metrics see {@link Metrics::getDefaultProcessedMetrics()}. | |
$module | string | The name of the module which is supposed to be equal to the name of the plugin. The module is detected automatically. | |
$name | string | The translated name of the report. The name will be used for instance in the mobile app or if another report defines this report as a related report. | |
$order | integer | The order of the report. Depending on the order the report gets a different position in the list of widgets, the menu and the mobile app. | |
$parameters | null | array | Some reports may require additional URL parameters that need to be sent when a report is requested. For instance a "goal" report might need a "goalId": array('idgoal' => 5). | |
$processedMetrics | array | Eg array('avg_time_on_site', 'nb_actions_per_visit', ...) | |
$recursiveLabelSeparator | string | Separator for building recursive labels (or paths) | |
$subcategoryId | string | The translation key of the subcategory the report belongs to. |
메소드 | 설명 | |
---|---|---|
__construct ( ) | The constructur initializes the module, action and the default metrics. If you want to overwrite any of those values or if you want to do any work during initializing overwrite the method {@link init()}. | |
alwaysUseDefaultViewDataTable ( ) : boolean | Returns if the default viewDataTable type should always be used. e.g. the type won't be changeable through config or url params. | |
checkIsEnabled ( ) | This method checks whether the report is available, see {@isEnabled()}. If not, it triggers an exception containing a message that will be displayed to the user. You can overwrite this message in case you want to customize the error message. Eg. | |
configureReportMetadata ( &$availableReports, $infos ) | If the report is enabled the report metadata for this report will be built and added to the list of available reports. Overwrite this method and leave it empty in case you do not want your report to be added to the report metadata. In this case your report won't be visible for instance in the mobile app and scheduled reports generator. We recommend to change this behavior only if you are familiar with the Piwik core. $infos contains the current requested date, period and site. | |
configureView ( |
Here you can configure how your report should be displayed and which capabilities your report has. For instance whether your report supports a "search" or not. EG $view->config->show_search = false. You can also change the default request config. For instance you can change how many rows are displayed by default: $view->requestConfig->filter_limit = 10;. See {@link ViewDataTable} for more information. | |
configureWidgets ( |
lets you add any amount of widgets for this report. If a report defines a {@link $categoryId} and a {@link $subcategoryId} a widget will be generated automatically. | |
fetch ( array $paramOverride = [] ) : |
Fetches the report represented by this instance. | |
fetchSubtable ( integer $idSubtable, array $paramOverride = [] ) : |
Fetches a subtable for the report represented by this instance. | |
getAction ( ) : string | Get the name of the action. | |
getActionToLoadSubTables ( ) : string | Get the action to load sub tables if one is defined. | |
getAllMetrics ( ) : array | Returns the array of all metrics displayed by this report. | |
getCategoryId ( ) : string | Get the translated name of the category the report belongs to. | |
getDefaultSortColumn ( ) | ||
getDefaultSortOrder ( ) | ||
getDefaultTypeViewDataTable ( ) : string | Returns the id of the default visualization for this report. Eg 'table' or 'pie'. Defaults to the HTML table. | |
getDimension ( ) : |
||
getDocumentation ( ) : string | Get report documentation. | |
getForDimension ( |
Finds a top level report that provides stats for a specific Dimension. | |
getMetrics ( ) : array | Returns an array of supported metrics and their corresponding translations. Eg array('nb_visits' => 'Visits'). | |
getMetricsForTable ( |
Returns the Metrics that are displayed by a DataTable of a certain Report type. | |
getMetricsRequiredForReport ( string[] | null $allMetrics = null, string[] | null $restrictToColumns = null ) : string[] | Returns the list of metrics required at minimum for a report factoring in the columns requested by the report requester. | |
getModule ( ) : string | Get the name of the module. | |
getName ( ) : string | Get the name of the report | |
getOrder ( ) : integer | Returns the order of the report | |
getParameters ( ) | ||
getProcessedMetrics ( ) : array | mixed | Returns an array of supported processed metrics and their corresponding translations. Eg array('nb_visits' => 'Visits'). By default the given {@link $processedMetrics} are used and their corresponding translations are looked up automatically. If a metric is not translated, you should add the default metric translation for this metric using the {@hook Metrics.getDefaultMetricTranslations} event. If you want to overwrite any default metric translation you should overwrite this method, call this parent method to get all default translations and overwrite any custom metric translations. | |
getProcessedMetricsById ( ) : Piwik\Plugin\ProcessedMetric[] | Returns an array mapping the ProcessedMetrics served by this report by their string names. | |
getProcessedMetricsForTable ( |
Returns the ProcessedMetrics that should be computed and formatted for a DataTable of a certain report. The ProcessedMetrics returned are those specified by the Report metadata as well as the DataTable metadata. | |
getRecursiveLabelSeparator ( ) | ||
getRelatedReports ( ) : |
Get the list of related reports if there are any. They will be displayed for instance below a report as a recommended related report. | |
getSubcategoryId ( ) : string | Get the translated name of the subcategory the report belongs to. | |
getSubtableDimension ( ) : |
Returns the Dimension instance of this report's subtable report. | |
hasGoalMetrics ( ) : boolean | ||
isEnabled ( ) : boolean | Defines whether a report is enabled or not. For instance some reports might not be available to every user or might depend on a setting (such as Ecommerce) of a site. In such a case you can perform any checks and then return true or false. If your report is only available to users having super user access you can do the following: return Piwik::hasUserSuperUserAccess(); | |
isSubtableReport ( ) : boolean | Returns true if the report is for another report's subtable, false if otherwise. | |
render ( ) : string | Renders a report depending on the configured ViewDataTable see {@link configureView()} and {@link getDefaultTypeViewDataTable()}. If you want to customize the render process or just render any custom view you can overwrite this method. |
메소드 | 설명 | |
---|---|---|
buildReportMetadata ( ) : array | Builts the report metadata for this report. Can be useful in case you want to change the behavior of {@link configureReportMetadata()}. | |
getMetricsDocumentation ( ) : array | Returns an array of metric documentations and their corresponding translations. Eg `array('nb_visits' => 'If a visitor comes to your website for the first time or if he visits a page more than 30 minutes after. | |
init ( ) | Here you can do any instance initialization and overwrite any default values. You should avoid doing time consuming initialization here and if possible delay as long as possible. An instance of this report will be created in most page requests. |
메소드 | 설명 | |
---|---|---|
getMetricTranslations ( $metricsToTranslate ) | ||
getSubtableApiMethod ( ) |
final public __construct ( ) |
public alwaysUseDefaultViewDataTable ( ) : boolean | ||
리턴 | boolean |
protected buildReportMetadata ( ) : array | ||
리턴 | array |
public checkIsEnabled ( ) |
public configureReportMetadata ( &$availableReports, $infos ) | ||
$availableReports | ||
$infos |
public configureView ( |
||
$view |
public configureWidgets ( |
||
$widgetsList | ||
$factory |
public fetchSubtable ( integer $idSubtable, array $paramOverride = [] ) : |
||
$idSubtable | integer | The subtable ID. |
$paramOverride | array | Query parameter overrides. |
리턴 |
public getActionToLoadSubTables ( ) : string | ||
리턴 | string |
public getAllMetrics ( ) : array | ||
리턴 | array |
public getCategoryId ( ) : string | ||
리턴 | string |
public getDefaultTypeViewDataTable ( ) : string | ||
리턴 | string |
public static getForDimension ( |
||
$dimension | The dimension whose report we're looking for. | |
리턴 | The |
public getMetrics ( ) : array | ||
리턴 | array |
protected getMetricsDocumentation ( ) : array | ||
리턴 | array |
public static getMetricsForTable ( |
||
$dataTable | ||
$report | ||
$baseType | string | The base type each metric class needs to be of. |
리턴 |
public getMetricsRequiredForReport ( string[] | null $allMetrics = null, string[] | null $restrictToColumns = null ) : string[] | ||
$allMetrics | string[] | null | The list of all available unprocessed metrics. Defaults to this report's metrics. |
$restrictToColumns | string[] | null | The requested columns. |
리턴 | string[] |
public getProcessedMetrics ( ) : array | mixed | ||
리턴 | array | mixed |
public getProcessedMetricsById ( ) : Piwik\Plugin\ProcessedMetric[] | ||
리턴 | Piwik\Plugin\ProcessedMetric[] |
public static getProcessedMetricsForTable ( |
||
$dataTable | ||
$report | ||
리턴 | Piwik\Plugin\ProcessedMetric[] |
public getRelatedReports ( ) : |
||
리턴 |
public getSubcategoryId ( ) : string | ||
리턴 | string |
public getSubtableDimension ( ) : |
||
리턴 | The subtable report's dimension or null if there is subtable report or no dimension for the subtable report. |
protected init ( ) |
public isSubtableReport ( ) : boolean | ||
리턴 | boolean |
protected string $action | ||
리턴 | string |
protected string $actionToLoadSubTables | ||
리턴 | string |
protected string $categoryId | ||
리턴 | string |
protected bool $constantRowsCount | ||
리턴 | boolean |
protected bool $defaultSortOrderDesc | ||
리턴 | boolean |
protected Dimension,Piwik\Columns $dimension | ||
리턴 |
protected string $documentation | ||
리턴 | string |
protected bool $hasGoalMetrics | ||
리턴 | boolean |
protected bool $isSubtableReport | ||
리턴 | boolean |
protected array $metrics | ||
리턴 | array |
protected string $module | ||
리턴 | string |
protected string $name | ||
리턴 | string |
protected int $order | ||
리턴 | integer |
protected array $processedMetrics | ||
리턴 | array |
protected string $recursiveLabelSeparator | ||
리턴 | string |
protected string $subcategoryId | ||
리턴 | string |