Piwik\DataAccess\LogAggregator::queryConversionsByDimension PHP Method

queryConversionsByDimension() public method

**Result Set** Each row of the result set represents an aggregated group of conversions. The following columns are in each aggregate row: - **{@link Piwik\Metrics::INDEX_GOAL_NB_CONVERSIONS}**: The total number of conversions in this aggregate group. - **{@link Piwik\Metrics::INDEX_GOAL_NB_VISITS_CONVERTED}**: The total number of visits during which these conversions were converted. - **{@link Piwik\Metrics::INDEX_GOAL_REVENUE}**: The total revenue generated by these conversions. This value includes the revenue from individual ecommerce items. - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_SUBTOTAL}**: The total cost of all ecommerce items sold within these conversions. This value does not include tax, shipping or any applied discount. _This metric is only applicable to the special **ecommerce** goal (where idGoal == 'ecommerceOrder')._ - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_TAX}**: The total tax applied to every transaction in these conversions. _This metric is only applicable to the special **ecommerce** goal (where idGoal == 'ecommerceOrder')._ - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_SHIPPING}**: The total shipping cost for every transaction in these conversions. _This metric is only applicable to the special **ecommerce** goal (where idGoal == 'ecommerceOrder')._ - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_DISCOUNT}**: The total discount applied to every transaction in these conversions. _This metric is only applicable to the special **ecommerce** goal (where idGoal == 'ecommerceOrder')._ - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_ITEMS}**: The total number of ecommerce items sold in each transaction in these conversions. _This metric is only applicable to the special **ecommerce** goal (where idGoal == 'ecommerceOrder')._ Additional data can be selected through the $additionalSelects parameter. _Note: This method will only query the **log_conversion** table. Other tables cannot be joined using this method._
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 function queryConversionsByDimension($dimensions = array(), $where = false, $additionalSelects = array())
    {
        $dimensions = array_merge(array(self::IDGOAL_FIELD), $dimensions);
        $tableName = self::LOG_CONVERSION_TABLE;
        $availableMetrics = $this->getConversionsMetricFields();
        $select = $this->getSelectStatement($dimensions, $tableName, $additionalSelects, $availableMetrics);
        $from = array($tableName);
        $where = $this->getWhereStatement($tableName, self::CONVERSION_DATETIME_FIELD, $where);
        $groupBy = $this->getGroupByStatement($dimensions, $tableName);
        $orderBy = false;
        $query = $this->generateQuery($select, $from, $where, $groupBy, $orderBy);
        return $this->getDb()->query($query['sql'], $query['bind']);
    }