Property | Type | Description | |
---|---|---|---|
$dateEnd | |||
$dateStart | |||
$segment | |||
$sites | int[] |
Method | Description | |
---|---|---|
__construct ( Piwik\ArchiveProcessor\Parameters $params ) | Constructor. | |
generateQuery ( $select, $from, $where, $groupBy, $orderBy, $limit, $offset ) | ||
getConversionsMetricFields ( ) | ||
getDb ( ) | ||
getMetricsFromVisitByDimension ( string $dimension ) : Piwik\DataArray | Helper function that returns an array with common metrics for a given log_visit field distinct values. | |
getSelectsFromRangedColumn ( string $column, array $ranges, string $table, string $selectColumnPrefix, boolean $restrictToReturningVisitors = false ) : array | Creates and returns an array of SQL SELECT expressions that will each count how many rows have a column whose value is within a certain range. | |
getSqlRevenue ( $field ) | ||
makeArrayOneColumn ( $row, $columnName, boolean $lookForThisPrefix = false ) : array | Clean up the row data and return values. | |
queryActionsByDimension ( array | string $dimensions, boolean | string $where = '', array $additionalSelects = [], boolean | array $metrics = false, boolean | Piwik\RankingQuery $rankingQuery = null, boolean | string $joinLogActionOnColumn = false ) : mixed | Executes and returns a query aggregating action data (everything in the log_action table) and returns a DB statement that can be used to iterate over the result | |
queryConversionsByDimension ( array | string $dimensions = [], boolean | string $where = false, array $additionalSelects = [] ) : Zend_Db_Statement | Executes a query aggregating conversion data (everything in the **log_conversion** table) and returns a DB statement that can be used to iterate over the result. | |
queryEcommerceItems ( string $dimension ) : Zend_Db_Statement | Executes and returns a query aggregating ecommerce item data (everything stored in the **log\_conversion\_item** table) and returns a DB statement that can be used to iterate over the result | |
queryVisitsByDimension ( array $dimensions = [], boolean | string $where = false, array $additionalSelects = [], boolean | array $metrics = false, boolean | Piwik\RankingQuery $rankingQuery = false ) : mixed | Executes and returns a query aggregating visit logs, optionally grouping by some dimension. Returns a DB statement that can be used to iterate over the result | |
setQueryOriginHint ( $nameOfOrigiin ) |
Method | Description | |
---|---|---|
getActionsMetricFields ( ) | ||
getDimensionsToSelect ( $dimensions, array $additionalSelects ) : array | Will return the subset of $dimensions that are not found in $additionalSelects | |
getGeneralQueryBindParams ( ) : array | Returns general bind parameters for all log aggregation queries. This includes the datetime start of entities, datetime end of entities and IDs of all sites. | |
getGroupByStatement ( $dimensions, $tableName ) | ||
getSelectAliasAs ( $metricId ) | ||
getSelectDimensions ( $dimensions, $tableName, boolean $appendSelectAs = true ) : mixed | Returns the dimensions array, where (1) the table name is prepended to the field (2) the "AS label " is appended to the field | |
getSelectStatement ( $dimensions, $tableName, $additionalSelects, array $availableMetrics, $requestedMetrics = false ) | ||
getSelectsMetrics ( $metricsAvailable, $metricsRequested = false ) | ||
getVisitsMetricFields ( ) | ||
getWhereStatement ( $tableName, $datetimeField, $extraWhere = false ) | ||
isFieldFunctionOrComplexExpression ( $field ) | ||
isMetricRequested ( $metricId, $metricsRequested ) |
Method | Description | |
---|---|---|
getSqlConversionRevenueSum ( $field ) | ||
prefixColumn ( string $column, string $tableName ) : string | Prefixes a column name with a table name if not already done. |
public __construct ( Piwik\ArchiveProcessor\Parameters $params ) | ||
$params | Piwik\ArchiveProcessor\Parameters |
public generateQuery ( $select, $from, $where, $groupBy, $orderBy, $limit, $offset ) |
protected getDimensionsToSelect ( $dimensions, array $additionalSelects ) : array | ||
$dimensions | ||
$additionalSelects | array | |
return | array |
protected getGeneralQueryBindParams ( ) : array | ||
return | array |
public getMetricsFromVisitByDimension ( string $dimension ) : Piwik\DataArray | ||
$dimension | string | Table log_visit field name to be use to compute common stats |
return | Piwik\DataArray |
protected getSelectDimensions ( $dimensions, $tableName, boolean $appendSelectAs = true ) : mixed | ||
$dimensions | ||
$tableName | ||
$appendSelectAs | boolean | |
return | mixed |
protected getSelectStatement ( $dimensions, $tableName, $additionalSelects, array $availableMetrics, $requestedMetrics = false ) | ||
$availableMetrics | array |
public static getSelectsFromRangedColumn ( string $column, array $ranges, string $table, string $selectColumnPrefix, boolean $restrictToReturningVisitors = false ) : array | ||
$column | string | The name of a column in `$table` that will be summarized. |
$ranges | array | The array of ranges over which the data in the table will be summarized. For example, ``` array( array(1, 1), array(2, 2), array(3, 8), array(8) // everything over 8 ) ``` |
$table | string | The unprefixed name of the table whose rows will be summarized. |
$selectColumnPrefix | string | The prefix to prepend to each SELECT expression. This prefix is used to differentiate different sets of range summarization SELECTs. You can supply different values to this argument to summarize several columns in one query (see above for an example). |
$restrictToReturningVisitors | boolean | Whether to only summarize rows that belong to visits of returning visitors or not. If this argument is true, then the SELECT expressions returned can only be used with the {@link queryVisitsByDimension()} method. |
return | array | An array of SQL SELECT expressions, for example, ``` array( 'sum(case when log_visit.visit_total_actions between 0 and 2 then 1 else 0 end) as vta0', 'sum(case when log_visit.visit_total_actions > 2 then 1 else 0 end) as vta1' ) ``` |
protected getSelectsMetrics ( $metricsAvailable, $metricsRequested = false ) |
protected getWhereStatement ( $tableName, $datetimeField, $extraWhere = false ) |
protected isFieldFunctionOrComplexExpression ( $field ) |
public static makeArrayOneColumn ( $row, $columnName, boolean $lookForThisPrefix = false ) : array | ||
$row | ||
$columnName | ||
$lookForThisPrefix | boolean | A string that identifies which elements of $row to use in the result. Every key of $row that starts with this value is used. |
return | array |
public queryActionsByDimension ( array | string $dimensions, boolean | string $where = '', array $additionalSelects = [], boolean | array $metrics = false, boolean | Piwik\RankingQuery $rankingQuery = null, boolean | string $joinLogActionOnColumn = false ) : mixed | ||
$dimensions | array | string | One or more SELECT fields that will be used to group the log_action rows by. This parameter determines which log_action rows will be aggregated together. |
$where | boolean | string | Additional condition for the WHERE clause. Can be used to filter the set of visits that are considered for aggregation. |
$additionalSelects | array | Additional SELECT fields that are not included in the group by clause. These can be aggregate expressions, eg, `SUM(somecol)`. |
$metrics | boolean | array | The set of metrics to calculate and return. If `false`, the query will select all of them. The following values can be used: - {@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS} - {@link Piwik\Metrics::INDEX_NB_VISITS} - {@link Piwik\Metrics::INDEX_NB_ACTIONS} |
$rankingQuery | boolean | Piwik\RankingQuery | A pre-configured ranking query instance that will be used to limit the result. If set, the return value is the array returned by {@link Piwik\RankingQuery::execute()}. |
$joinLogActionOnColumn | boolean | string | One or more columns from the **log_link_visit_action** table that log_action should be joined on. The table alias used for each join is `"log_action$i"` where `$i` is the index of the column in this array. If a string is used for this parameter, the table alias is not suffixed (since there is only one column). |
return | mixed | A Zend_Db_Statement if `$rankingQuery` isn't supplied, otherwise the result of {@link Piwik\RankingQuery::execute()}. Read [this](#queryEcommerceItems-result-set) to see what aggregate data is calculated by the query. |
public queryConversionsByDimension ( array | string $dimensions = [], boolean | string $where = false, array $additionalSelects = [] ) : Zend_Db_Statement | ||
$dimensions | array | string | One or more **SELECT** fields that will be used to group the log_conversion rows by. This parameter determines which **log_conversion** rows will be aggregated together. |
$where | boolean | string | An optional SQL expression used in the SQL's **WHERE** clause. |
$additionalSelects | array | Additional SELECT fields that are not included in the group by clause. These can be aggregate expressions, eg, `SUM(somecol)`. |
return | Zend_Db_Statement |
public queryEcommerceItems ( string $dimension ) : Zend_Db_Statement | ||
$dimension | string | One or more **log\_conversion\_item** columns to group aggregated data by. Eg, `'idaction_sku'` or `'idaction_sku, idaction_category'`. |
return | Zend_Db_Statement | A statement object that can be used to iterate through the query's result set. See [above](#queryEcommerceItems-result-set) to learn more about what this query selects. |
public queryVisitsByDimension ( array $dimensions = [], boolean | string $where = false, array $additionalSelects = [], boolean | array $metrics = false, boolean | Piwik\RankingQuery $rankingQuery = false ) : mixed | ||
$dimensions | array | `SELECT` fields (or just one field) that will be grouped by, eg, `'referrer_name'` or `array('referrer_name', 'referrer_keyword')`. The metrics retrieved from the query will be specific to combinations of these fields. So if `array('referrer_name', 'referrer_keyword')` is supplied, the query will aggregate visits for each referrer/keyword combination. |
$where | boolean | string | Additional condition for the `WHERE` clause. Can be used to filter the set of visits that are considered for aggregation. |
$additionalSelects | array | Additional `SELECT` fields that are not included in the group by clause. These can be aggregate expressions, eg, `SUM(somecol)`. |
$metrics | boolean | array | The set of metrics to calculate and return. If false, the query will select all of them. The following values can be used: - {@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS} - {@link Piwik\Metrics::INDEX_NB_VISITS} - {@link Piwik\Metrics::INDEX_NB_ACTIONS} - {@link Piwik\Metrics::INDEX_MAX_ACTIONS} - {@link Piwik\Metrics::INDEX_SUM_VISIT_LENGTH} - {@link Piwik\Metrics::INDEX_BOUNCE_COUNT} - {@link Piwik\Metrics::INDEX_NB_VISITS_CONVERTED} |
$rankingQuery | boolean | Piwik\RankingQuery | A pre-configured ranking query instance that will be used to limit the result. If set, the return value is the array returned by {@link Piwik\RankingQuery::execute()}. |
return | mixed | A Zend_Db_Statement if `$rankingQuery` isn't supplied, otherwise the result of {@link Piwik\RankingQuery::execute()}. Read {@link queryVisitsByDimension() this} to see what aggregate data is calculated by the query. |